Subject Re: [IBO] IB_SQL: Problems executing script
Author Helen Borrie (TeamIBO)
At 12:59 AM 17-04-02 -0700, you wrote:
> > Use single quotes on the path string. IB 6 and Firebird are now
> > extra-fussy about not confusing single and double-quotes. The unbreakable
> > rule is now "single-quotes for strings, double-quotes for delimited
> > identifiers".
>
>Ok. I changed it to:
>
>CONNECT 'c:\mypath\mydb.gdb' USER 'sysdba' PASSWORD 'masterkey';
>
>It still doesn't work. The exact error that I get is "Invalid CREATE, CONNECT
>or DROP DATABASE syntax."

It's not valid to call CONNECT on a database to which you are already
connected. Simply comment this out if you want to run the script while
already connected - which you normally would be if you were running a DML
script in IB_SQL.


>Ok. I found the source of the hanging problem. It was some incorrect
>syntax in
>my script. I had a statement like the following:
>
>update mytable set col1=col1a, set col2=col2a, set col3=col3a;
>
>The problem was the extra "set" words in there. Once I removed them, it
>worked
>fine. Still seems strange, though, that that would cause it to hang
>instead of
>giving an error message.

It didn't hang: it was waiting for a COMMIT statement. See my previous
comments about DML statements in scripts. That button which you referred
to as "the check button" is the COMMIT button. You will continue to run
into all sorts of problems until you decide for yourself a "standard" way
to connect and run things, e.g.

either...always use a CONNECT string in your script and run it while not
connected to a database or...always connect first and omit the CONNECT
statement.

either...always include COMMIT statements for DDL in scripts...or....never
include commits and always make a point of using the COMMIT (or ROLLBACK)
button when a script finishes or stops with an error (respectively). The
effects will be slightly different, for example, in some scripts you will
have a definite motive for committing one statement before running another,
e.g. the later statement has a dependency on the earlier one. The "commit
everything at the end" approach is OK if your DML isn't creating data that
are dependent upon one another.


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