Using Open Client Library, you can connect to a specific database on a server with multiple databases.
Set up entries in the interfaces file for the server.
Use the -n parameter on the start_iq command to set up a shortcut for the database name.
Specify the -S database_name parameter with the database name on the isql command. This parameter is required whenever you connect.
You can run the same program against multiple databases without changing the program itself by putting the shortcut name into the program and merely changing the shortcut definition.
For example, the following interfaces file excerpt defines two servers, live_sales and test_sales:
live_sales
query tcp ether myhostname 5555 master tcp ether myhostname 5555
test_sales
query tcp ether myhostname 7777 master tcp ether myhostname 7777
Start the server and set up an alias for a particular database. The following command sets live_sales equivalent to salesbase.db:
start_iq -n sales_live <other parameters> -x \ ‘tcpip{port=5555}’ salesbase.db -n live_sales
To connect to the live_sales server:
isql -Udba -Psql -Slive_sales
A server name may only appear once in the interfaces file. Because the connection to Sybase IQ is now based on the database name, the database name must be unique. If all your scripts are set up to work on salesbase database, you will not have to modify them to work with live_sales or test_sales.