CREATE SERVER statement - Examples of the ODBC wrapper
Use the CREATE SERVER statement to register server definitions for the ODBC wrapper. This topic provides a complete example with the required parameters, and an example with additional server options.
The following example shows you how to register a server definition for a SAP HANA data source by issuing the CREATE SERVER statement:
Example for DSN mode connection:
CREATE SERVER hana_server TYPE HANA
VERSION 5.0 WRAPPER odbcwrapper
OPTIONS (NODE 'hana_node', DBNAME 'venice')
Example
for DSN-less mode connection:CREATE SERVER hana_server TYPE HANA
VERSION 5.0 WRAPPER odbcwrapper
OPTIONS (HOST 'hana.cn.ibm.com’, PORT '30015' DBNAME 'venice')
Server options
When you create the server definition, you can specify additional server options in the CREATE SERVER statement. The server options can be general server options and ODBC-specific server options.
Some ODBC data sources (for
example, MySQL) cannot process quotation marks around table names
and column names in SQL statements. To access these data sources,
you must include the following server options in the CREATE SERVER
statement:
- DB2_TABLE_QUOTE_CHAR ' ` '
- DB2_ID_QUOTE_CHAR ' ` '
- DB2_AUTHID_QUOTE_CHAR ' ` '
The ` character is the delimiter for identifiers such as schema names, table names, and column names.
For example:
CREATE SERVER server_name TYPE type_name
VERSION 4.0 WRAPPER wrapper_name
OPTIONS (NODE 'testnode', DB2_TABLE_QUOTE_CHAR '`',
DB2_ID_QUOTE_CHAR '`', DB2_AUTHID_QUOTE_CHAR '`')