cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

I'm trying to connect to a database and run a script using dbisql. I've checked the docs and tried many combinations but I guess I'm missing something.

For example:

dbisql -nogui -c "uid=dba;pwd=sql"

results in:

((not connected)

whereas if I write:

dbisql -c "uid=dba;pwd=sql"

an Interactive SQL window opens as connected.

What I'd really like to is call dbisql -nogui -c "uid=dba;pwd=sql" myscript.sql but I'm stuck on the first step.

Notes:

  • I have both SA9 and SA12 installed on this machine.
  • I'm working on SA12 Bin32 directory.
  • -nogui -c "uid=dba;pwd=sql" line works with SA9 dbisql command.
  • v12.0.1.3769

Update:

According to the docs, the following command should work against the default database although Links property is missing:

dbisql -c "UID=DBA;PWD=sql" -onerror exit mycom.sql

However, I get the message "You are not connected to a database". On the other hand, I can connect to the same database smoothly via Interactive SQL window (choosing 'connect to a running database on this computer'). dbping -d -c "UID=DBA;PWD=sql" succeeds with the same connection string stating it connected to the database. The target database is started with -x none switch.

Is there anything else I'm missing?

Screenshots:

Dbsrv12:
Running a script file with dbisql commandline

Dbping & Dbisql:
Running a script file with dbisql commandline

Dbisql window (works ok):
Running a script file with dbisql commandline

View Entire Topic
Former Member
0 Likes

You will see this behaviour when running dbisql.exe from a Windows command prompt. For .bat file you should run with dbisql.com which is created for that purpose.

Reference: http://dcx.sybase.com/index.html#1201/en/dbadmin/dbisql-interactive-dbutilities.html

HTH


. . . "For Windows, there are two executables:"

"1.Batch scripts should call dbisql or dbisql.com, not dbisql.exe. The dbisql.com executable is linked as a console application. "

"2.The dbisql.exe executable is linked as a windowed application and does not block the command shell from which it was started. If dbisql.exe is run from a batch file, you won't see any output sent to the standard output or standard error files. "


VolkerBarth
Contributor
0 Likes

Well, AFAIK, if you don't specify a file extension, .com will have higher precedence than .exe (and the doc seem to cope with that), so Henginy - who does not use an extension - should already use dbisql.com, right?