in reply to Data export into text file

I would start by looking at DBI. Then make sure the database the information is in has a DBD::(your database here). Then a script can be written to extract the fields and with perl it can then be mangled as desired and output.

One option you didn't mention and may not have considered is that with DBI you can open 2 databases at once and read records out of one while writing the data into the other one. The databases of course can be completely different types

For example for Oracle to PostgreSQL you might go along these lines

use DBI; my $pgh=DBI->connect("DSN for Postgres here"); my $orh=DBI->connect("DSN for Oracle here"); #set up statments into variables for both eval{ my $psh=$pgh->prepare($write_stmt); my $osh=$orh->prepare($read_stmt); $osh->execute( variable list here ); $osh->bind_columns( \( $f1, $f2, $f3, ... ) ); while($osh->fetch) { $psh->execute( $f1, $f2, $f3, ... ); } $pgh->commit; } if($@) # error handler goes here { $pgh->rollback; print STDERR "Problem saving data\n"; }

Update: Fixed a type $pgh->execute should be $psh->execute. ie. use the statement handle not the DB handle for execute.

Replies are listed 'Best First'.
Re: Re: Data export into text file
by b310 (Scribe) on Mar 17, 2003 at 18:33 UTC
    Hi Dga,

    I was not aware that two databases can be open.

    Would your suggestion work if one table that contains the data is on my hosting server provider while the database to which I want to export is located on my hard drive in Access?

      If you can provide a DSN suitable to open the connection from your local machine, you could use that database. If you have shell access at your provider then you may be able to use the DBD::Proxy modules to open a connection locally there and proxy it out so you can see if from your local machine. I would be sure to do this over a secure channel ie. ssh or the encrypting variations of the proxy and make sure that no one else can use the proxy otherwise you open up a connection for anyone to query your data. I believe the proxy modules can be set up to allow read only access which would mitigate the risk to a large degree on the remote end

      <remote-db> - <DBD::(rem db)> - <DBD::Proxy> #remote -> #local <DBD::Proxy> - <DBD::Access> - <Access>

      The connection between the Proxy modules being read only from external. The Proxy's can have an encryption set up between them etc.