Defining ODBC external servers

The most common way of defining an ODBC-based server is to base it on an ODBC data source. To do this, you can create a data source using the ODBC Administrator.

For more information, see Creating an ODBC data source.

Once you have defined the data source, 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, see CREATE SERVER statement.

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 11;ENG=TestSA;DBN=sample;LINKS=tcpip()';

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

See also

For information specific to particular ODBC server classes, see: