Before you can begin working with a database, you must connect to it.
When a database server is started, it assigns a unique connection ID to each new connection to it. You can obtain a user's connection-id using the CONNECTION_PROPERTY function to request the connection number. The following statement returns the connection ID of the current connection:
SELECT CONNECTION_PROPERTY( 'number' );
Choose Connections > Connect with SQL Anywhere 10.
The Connect dialog appears.
In the Connect dialog, specify the connection information, or ODBC data source name, to use to connect to the database, and then choose OK.
Execute a CONNECT statement.
For more information, see CONNECT statement [ESQL] [Interactive SQL].
The following statement shows how to use CONNECT from Interactive SQL to connect to a database that has been started:
CONNECT to 'sample' DATABASE tempdb AS conn1 USER 'DBA' IDENTIFIED BY 'sql';
In this example, sample is the server name, tempdb is the database name, conn1 is the connection identifier, DBA is the user name, and sql is the password.
The following statement shows how to use CONNECT in embedded SQL:
EXEC SQL CONNECT "DBA" IDENTIFIED BY "sql";