beautypg.com

Connecting to an embedded database – Sybase 12.4.2 User Manual

Page 77

background image

CHAPTER 2 Running Adaptive Server IQ

57

To connect to a database from DBISQL on UNIX:

1

Start the server and the database by typing at a system command prompt:

start_asiq

dbname

2

Start DBISQL by typing at a system command prompt:

dbisql -c

"uid=userID;pwd=password;eng=

dbname;links=tcpip"

For example, to connect to the sample database you would enter:

dbisql -c

"uid=DBA;pwd=SQL;eng=asiqdemo;links=tcpip"

The

–c

parameter specifies connection parameters. See “Connection

parameters” for more about connection parameters.

To connect to a system on a foreign host, you must add the host:

dbisql -c "uid=DBA;pwd=SQL;eng=

dbname;

links=tcpip(host=

hostname"

If the host was started with a non-default port number (not 2638) then the
port number must be added as well:

dbisql -c "uid=DBA;pwd=SQL;eng=anotherdb;

links=tcpip(host=

hostname;port=nnnn)"

Connecting to an embedded database

An embedded database, designed for use by a single application, runs on the
same machine as the application and is largely hidden from the application
user.

When an application uses an embedded database, the database server is
generally not running when the application connects. In this case, you can start
the database using the connection string, and by specifying the database file in
the DatabaseFile (DBF) parameter of the connection string.

Using the DBF
parameter

The DBF parameter specifies which database file to use. The database file
automatically loads onto the default server, or starts a server if none is running.

The database unloads when there are no more connections to the database
(generally when the application that started the connection disconnects). If the
connection started the server, it stops once the database unloads.