In many cases, establishing a connection to a database is straightforward using the information presented in the first part of this chapter.
However, if you are having problems establishing connections to a server, you may need to understand the process by which SQL Anywhere establishes connections to resolve your problems. This section describes how SQL Anywhere connections work.
For more information about network-specific issues, including connections across firewalls, see Client/Server Communications.
The software follows exactly the same procedure for each of the following types of client application:
ODBC Any ODBC application using the SQLDriverConnect function, which is the common method of connection for ODBC applications. Many application development systems, such as Sybase PowerBuilder, belong to this class of application. The SQLConnect function is also available to ODBC applications.
Embedded SQL Any client application using embedded SQL and using the recommended function for connecting to a database (db_string_connect).
In addition, The SQL CONNECT statement is available for embedded SQL applications and in Interactive SQL. It has two forms: CONNECT AS... and CONNECT USING. All the database administration tools, including Interactive SQL, use db_string_connect.
OLE DB Any ADO application using the ADODB Connection object. The Provider property is used to locate the OLE DB driver. The Connection String property may use DataSource as an alternative to DataSourceName and User ID as an alternative to UserID.
JDBC Applications using the iAnywhere JDBC driver pass the URL jdbc:ianywhere: followed by a standard connection string as a parameter to the Driver Manager.GetConnection method. The connection string must include DataSource= and name a SQL Anywhere data source or include Driver=SQL Anywhere 10 (this parameter is specified as Driver=libdbodbc10 on Unix and Linux).
The steps in establishing a connection
Locating the interface library
Assembling a list of connection parameters
Locating a database server
Locating the database
Server name caching for faster connections
Interactive SQL connections
Testing that a server can be found