Subject | Re: [IBO] Please reply ! |
---|---|
Author | Helen Borrie (TeamIBO) |
Post date | 2002-04-11T01:43:14Z |
At 04:45 PM 10-04-02 +0000, rodbracher wrote:
(1) Commit the script transaction?
(2) Check that the transaction is complete and, if not, roll it back?
(3) Disconnect from TEST1.GDB before attempting to re-run the script to
create TEST2.GDB?
using the default transaction, and start an isql session. After that, isql
itself takes care of the transactions that it needs. Once the script
completes, your ib_connection is connected to the new database but there is
no transaction active. If the default transaction *were* active, it would
be associated with the connection to the new database, not with a
connection to isql.
So you need to get back to ground zero before attempting to run another
instance of a script to create a different database. (This doesn't apply
if your next script is going to just do stuff in the database you just
created, and are already connected to).
job transparently, but minus the debugging capabilities of the IB_Script
approach - IB_Script has a lot of stuff to enable you to quiz the batch
statement-by-statement whilst the script is running...
You might get a better feel for how IB_Script works if you played about a
bit with the script tool in IB_SQL, which uses IB_Script. Take a look at
the source code for that tool; and also the sources for the Tutorial and
Contact sample apps, since they create databases "on the fly" using IB_Script.
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com
>Using tIB_Script I execute :Do you then
>
>SET SQL DIALECT 3;
>SET AUTODDL ON;
>
>I then have a tIB_Script to create a DB :
>
>CREATE DATABASE 'C:\DelphDat\sqldatafile\TEST1.GDB'
>USER 'SYSDBA' PASSWORD 'masterkey'
>DEFAULT CHARACTER SET NONE;
>CREATE TABLE TESTTABLE (
>F1 SMALLINT NOT NULL,
>F2 SMALLINT NOT NULL,
>F3 INTEGER );
(1) Commit the script transaction?
(2) Check that the transaction is complete and, if not, roll it back?
(3) Disconnect from TEST1.GDB before attempting to re-run the script to
create TEST2.GDB?
>If I run then script again, just changing line[0] toEach instance of the script will start its own connection to the server,
>CREATE DATABASE 'C:\DelphDat\sqldatafile\TEST2.GDB'
>
>I get the error - 'Invalid Database handle - no active transaction'
using the default transaction, and start an isql session. After that, isql
itself takes care of the transactions that it needs. Once the script
completes, your ib_connection is connected to the new database but there is
no transaction active. If the default transaction *were* active, it would
be associated with the connection to the new database, not with a
connection to isql.
So you need to get back to ground zero before attempting to run another
instance of a script to create a different database. (This doesn't apply
if your next script is going to just do stuff in the database you just
created, and are already connected to).
>If I run the above mentioned process in IBConsole, I works fine.I *think* IBConsole uses the Services API to run scripts, which does the
job transparently, but minus the debugging capabilities of the IB_Script
approach - IB_Script has a lot of stuff to enable you to quiz the batch
statement-by-statement whilst the script is running...
You might get a better feel for how IB_Script works if you played about a
bit with the script tool in IB_SQL, which uses IB_Script. Take a look at
the source code for that tool; and also the sources for the Tutorial and
Contact sample apps, since they create databases "on the fly" using IB_Script.
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com