This chapter describes how client applications connect to databases. It contains information about connecting to databases from ODBC, OLE DB, and Embedded SQL applications. It also describes connecting from Sybase Central and Interactive SQL.
For more information on connecting to a database from Sybase Open Client™ applications, see Chapter 3, “Sybase IQ as a Data Server,” in System Administration Guide: Volume 2.
For more information on connecting via JDBC (if you are not working in Sybase Central or Interactive SQL), see SQL Anywhere Server – Programming.
Any client application that uses a database must establish a connection to that database before any work can be done. The connection forms a channel through which all activity from the client application takes place. For example, your user ID determines permissions to carry out actions on the database—and the database server has your user ID because it is part of the request to establish a connection.
Some client tools may not clearly indicate connection status. A failed command is your first indication that the connection does not exist. A quick way to confirm the connection is by querying the database name.
To display the current database, use this syntax:
select db_name()
To specify a different database, use this syntax:
select db_name([ database_id ])