Sybase 12.4.2 Connecting to an embedded database, To connect to a database from Dbisql on Unix

Models: 12.4.2

1 536
Download 536 pages 20.34 Kb
Page 77
Image 77

CHAPTER 2 Running Adaptive Server IQ

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 –cparameter 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

Using the DBF parameter

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.

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.

57

Page 77
Image 77
Sybase 12.4.2 manual Connecting to an embedded database, Start Dbisql by typing at a system command prompt