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?

asked 01 May, 13:19

solomond's gravatar image

solomond
315
accept rate: 0%


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

permanent link

answered 01 May, 14:24

Mark%20Culp's gravatar image

Mark Culp
23.3k9132275
accept rate: 40%

The pattern you are describing indicates you desire/require the database to autostart.

It is unfortunate that dbisql won't prompt the connection dialog AND read the cmdline at the same time. I run into that regularily myself. You can always try including DBF= ...; and DBK=...; in your connection string.

The main issue with doing that is your client now knows the decryption key. It is usually better to have the database running as a service and take further measures to protect that key from casual expose.

If you are in the middle of development you could also consider leaving off encrypting your databases until you have real production or user information that needs protection.

If you must autostart the database and provide the encryption key you can consider burying the key inside of a configuration file and reference that in your cmdline as in:

dbisql @at_isql.txt

customizing that file as suited to your needs and combine that with other parameter as needed. The key can then be protected by using dbfhide.

permanent link

answered 01 May, 14:35

Nick%20Elson%20SAP%20SQL%20Anywhere's gravatar image

Nick Elson S...
7.3k35107
accept rate: 31%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×79

question asked: 01 May, 13:19

question was seen: 198 times

last updated: 01 May, 14:35