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.

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 IBM DB2 server named mydb2 whose data source name is also mydb2, use:
CREATE SERVER mydb2
CLASS 'db2odbc'
USING 'mydb2';

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 remote database may be as follows:

CREATE SERVER TestAA
CLASS 'saodbc'
USING 'DRIVER=Sybase IQ 16;HOST=myhost;Server=TestAA;DBN=sample';

This defines a connection to a database server named TestAA, running on a computer called myhost, and a database named sample using the TCP/IP protocol.