Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

ODBC-based server classes Next Page

Defining ODBC external servers


The most common way of defining an ODBC-based server bases it on an ODBC data source. To do this, you must create a data source in the ODBC Administrator.

Once you have the data source defined, the USING clause in the CREATE SERVER statement should match the ODBC data source name.

For example, to configure a DB2 server named mydb2 whose Data Source Name is also mydb2, use:

CREATE SERVER mydb2
CLASS 'db2odbc'
USING 'mydb2'

For more information on creating data sources, see Creating an ODBC data source.

Using connection strings instead of data sources

An alternative, which avoids using data sources, is to supply a connection string in the USING clause of the CREATE SERVER statement. To do this, you must know the connection parameters for the ODBC driver you are using. For example, a connection to a SQL Anywhere database may be as follows:

CREATE SERVER TestSA
CLASS 'saodbc'
USING 'driver=SQL Anywhere 10;eng=TestSA;dbn=sample;links=tcpip{}'

This defines a connection to a SQL Anywhere database server named TestSA and a database sample using the TCP-IP protocol.

See also

For information specific to particular ODBC server classes, see: