Though it might "feel" simpler to stick to Perl and use DBI, for the database in question the approach of going out to the system is likely the cleanest, safest and fastest.
In a nutshell, what he is trying to do is:
dbinit my_new_db.db
dbunload my_old_db <<- this creates a file called "reload.sql"
dbisql my_new_db.db read reload.sql
throw in some error checking (exit codes, file/directory exists, etc...) and you've got a great rebuild/upgrade mechanism.
I've done exactly this in Perl, Bash/Sh, and .CMD/.BAT.
| [reply] [d/l] |
| [reply] [d/l] |
Or am I missing a fine point here?
According to what OP is trying to do and what mobigeek posted, to unload data from the old database you need to start the database again. The database (ie. dbeng9) and sql tool (ie. dbisql) are separate processes that have to run at the same time, hence it is not sequential.
This being said, it is also possible to tell dbisql to automatically start the database itself. So while connecting to the database, dbisql will figure out that the database isn't actually running so it will launch it using the information you provide and then connect to it. See the "start" connection parameter in the online documentation.
| [reply] |