Updating a Remote Database?
Posted in 1995
My need is to update a remote database each day. I would like to export
the data from my local database to ASCII flat files using the SQL unload
statement and then make it available for downloading (using Zmodem,
Kermit, or some other modem protocol) by the remote site.
At the opposite end a script will run which will use a SQL load statement
to load the data into the remote database. My problem is that some of the
records that are exported from my local database will update existing records
in the remote database. The SQL load command only allows an insert clause
for records being loaded from a flat file.
I've thought about writing shell scripts which will basically load the
flat file a record at a time, doing a select first to see if the record
exists in the remote database and performing an update instead if necessary.
These shell scripts would rely on dbaccess to run the SQL commands and a
very twisted series of awk, sed, and grep statements would follow (through
Unix pipes) to determine if the record already existed in the database.
I've also thought about using isqlperl which will simplify the process a bit.
I do have ESQL but I would like to keep the solution to this problem script
based.
I'm running Online 5.04 on Solaris 2.4. Any (and all) other suggestions
greatly appreciated.
Sal.
---
Salvatore Saieva
PRINCIPIA Partners, LLC E-Mail: uunet!merccap!saieva
Harborside Financial Center Phone: (201) 946-0300
902 Plaza II, 9th Floor Fax: (201) 946-0320
Jersey City, NJ 07311
Exhortation: ``Aesthetics are more important than efficiency.'' -DEK