cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting to the database in a batch script

Former Member
0 Kudos
4,108

I am unable to connect to my database in a batch script. When I ping it, it fails. But when I open up scjview and connect (either with a connection profile or entering in the username, password, database file, and encryption key) it works. How can I do this sequence just on the commandline to connect and then run a script?

This is what is not working

dbisql -c "uid=DBA;pwd=sql;eng=servername" myscript.sql

This ping also does not work

dbping -d -c "uid=DBA;pwd=sql"

However, if I do this:

dbisql -c "uid=DBA;pwd=sql;eng=servername"

and then manually enter in the database file and encryption key, the previous commands all work. How do I include entering the database file and encyption key to this command?

View Entire Topic
MarkCulp
Participant

It sounds like you simply need to provide more connection parameters to your -c "..." string.

Take a look here - you likely want to add DBN (database name), DBF (database file), and DBKEY (database encryption key - needed if you are autostarting an encrypted database).

HTH