Data-source specification

Each DSN in the data sources section has a data-source specification section.

The following example illustrates a data-source specification format:
[data_source_name] 
Driver=driver_path
Description=data_source_description
Database=database_name
LogonID=user_id
pwd=user_password
Server=database_server
CLIENT_LOCALE=application_locale
DB_LOCALE=database_locale
TRANSLATIONDLL=translation_path
CURSORBEHAVIOR=cursor_behavior
DefaultUDTFetchType=default_UDT_Fetch_type
ENABLESCROLLABLECURSORS=enable_scroll_cursors
ENABLEINSERTCURSORS=enable_insert_cursors
OPTIMIZEAUTOCOMMIT=optimize_auto_commit
NEEDODBCTYPESONLY=need_odbc_types_only
OPTOFC=open_fetch_close_optimization
REPORTKEYSETCURSORS=report_keyset_cursors
FETCHBUFFERSIZE=fetchbuffer_size
DESCRIBEDECIMALFLOATPOINT=describe_decimal_as_float
USESERVERDBLOCALE=use_server_dblocale
DONOTUSELVARCHAR=do_not_use_lvarchar
REPORTCHARCOLASWIDECHARCOL=char_col_as_widechar_col
UPDATE_DESCRIBE=update_describe
[ODBC]
   UNICODE=unicode_type
LENGTHINCHARFORDIAGRECW=bufferlength_as_number_of_characters
LEAVE_TRAILING_SPACES=leave_trailing_spaces
The following table describes the keywords that are in the data-source specification section and the order that they appear in each section.
Keywords Description Status
data_source_name Data source specified in the Data Sources section Required
Driver Path for the driver

Set this value to the complete path name for the driver library. For more information about the library directory and file names, see the release notes.

Required
Description Description of the DSN

Configured for a single user or for system users.

Optional
Database Database to which the DSN connects by default Required
LogonID User identification or account name for access to the DSN Optional
pwd Password for access to the DSN Optional
Server HCL OneDB™ database server on which database_name is in Required
CLIENT_LOCALE (GLS only) Client locale. Default value: en_us.8859-1 Optional
DB_LOCALE (GLS only) Database locale. Default value: en_us.8859-1 Optional
TRANSLATIONDLL (GLS only) DLL that performs code-set conversion; default value: $ONEDB_HOME/lib/esql/ig04a304.xx where xx represents a platform-specific file extension Optional
CURSORBEHAVIOR Flag for cursor behavior when a commit or rollback transaction is called.
Possible values are:
  • 0=close cursor
  • 1=preserve cursor

Default value: 0

Optional
DefaultUDTFetchType Default UDT fetch type.

Default value: SQL_C_BINARY

Possible values are:
  • SQL_C_BINARY
  • SQL_C_CHAR
Optional
ENABLESCROLLABLECURSORS If this option is activated, the HCL OneDB ODBC Driver supports only scrollable, static cursors.
Available only as a connection option:
SQL_INFX_ATTR_ENABLE_SCROLL_CRUSORS
or as a connection attribute string:
EnableScrollableCursors

Default value is: 0 (disabled)

Optional
ENABLEINSERTCURSORS Reduces the number of network messages sent to and from the server by buffering the inserted rows used with arrays of parameters and insert statements. This option improves the performance of bulk insert operations.
Available as both a connection and statement option:
SQL_INFX_ATTR_ENABLE_INSERT_CURSORS
or as a connection attribute string:
EnableInsertCursors

Default value is: 0

Optional
OPTIMIZEAUTOCOMMIT Defers automatic commit operations while cursors remain open. This option can reduce database communication when the application is using non-ANSI logging databases.
Available as a connection option:
SQL_INFX_ATTR_OPTIMIZE_AUTOCOMMIT
or as a connection attribute string:
OptimizeAutoCommit

Default value is: 1 (enabled)

Optional
OPTOFC Causes the driver to buffer the open, fetch, and close cursor messages to the server. This option eliminates one or more message cycles when you use SQLPrepare, SQLExecute, and SQLFetch statements to fetch data with a cursor.
Only available as a connection option:
SQL_INFX_ATTR_OPTOFC
or as a connection attribute string:
OPTOFC

Default is: 0 (disabled)

Optional
REPORTKEYSETCURSORS Causes the driver to report (through SQLGetInfo) that is supports forward-only, static, and keyset-driver cursors even though the driver only supports forward-only and static cursors. This option is used to enable dynaset-type functions, such as Microsoft™ Visual Basic, which require drivers that support keyset-driven cursors.
Also available as connection option:
SQL_INFX_ATTR_REPORT_KEYSET_CURSORS
or as a connection attribute string:
ReportKeysetCursors

Default is: 0 (disabled)

Optional
FETCHBUFFERSIZE Size of a fetch buffer in bytes.
Available as connection attribute string:
FETCHBUFFERSIZE

The maximum size of the fetch buffer is 2 GB.

Default is: 32767

Optional
DESCRIBEDECIMALFLOATPOINT Describes all floating-point decimal columns as:
  • Float(SQL_REAL) or
  • Float(SQL_DOUBLE)

A floating-point decimal column is a column that was created without a scale, for example DECIMAL(12). Some prepackaged applications such as Visual Basic cannot properly format Decimal columns that do not have a fixed scale. To use these applications, you must enable this option or redefine the column with a fixed scale.

Enabling this option has the disadvantage that SQL_DECIMAL is an exact numeric data type while SQL_REAL and SQL_DOUBLE are approximate numeric data types. SQL_DECIMAL with a precision of 8 or less are described as SQL_REAL. With a precision greater than 8, it is described as SQL_DOUBLE.

Available as connection attribute string:
DESCRIBEDECIMALFLOATPOINT

Default is: 0 (disabled)

Optional
USESERVERDBLOCALE Users server database locale.
Available as a connection attribute string:
USERSERVERDBLOCALE

Default is: 0 (disabled)

Optional
DONOTUSELVARCHAR If enabled, the SQLGetTypeInfo does not report LVARCHAR as a supported type (DATA_TYPE) of SQL_VARCHAR. Some applications use LVARCHAR instead of VARCHAR, even in columns that are less than 256 bytes. The minimum number of bytes transmitted for LVARCHAR is higher than VARCHAR. Many LVARCHAR columns can result in the rowset size exceeding the maximum.
Important: Enable this option only if your SQL_VARCHAR columns are less than 256 bytes.
Available as a connection attribute string:
DONOTUSELVARCHAR

Default is: 0 (disabled)

Optional
REPORTCHARCOLASWIDECHARCOL Causes SQLDescribeCol to report character columns as wide character columns as follows:
  • SQL_CHAR is reported as SQL_WCHAR
  • SQL_VARCHAR is reported as SQL_WVARCHAR
  • SQL_LONGVARCHAR is reported as SQL_WLONGVARCHAR
Available as a connection attribute string:
REPORTCHARCOLASWIDECHARCOL

Default is: 0 (disabled)

Optional
UPDATE_DESCRIBE OR UPD_DESC This is required particularly for BLOB/CLOB data types. If enabled, server will send the description of these data types which will be used by ODBC Driver. This option should only be enabled when needed. It should not be turned on all the time as that would cause more round trips between client and server.
Possible values are:
  • 0
  • 1
Default value is: 0
Optional
UNICODE Indicates the type of Unicode used by an application. This attribute applies to UNIX™ applications only and is set in the ODBC section of the odbc.ini file. The following considerations apply:
  • Applications on UNIX not linking to Data Direct ODBC driver manager should set this to UCS-4
  • Applications on IBM AIX® with version lower than 5L should set this attribute to UCS-2.
  • Applications using Data Direct driver manager do not need to set this attribute.

Default is: UTF-8

For more information about using Unicode in an ODBC application, see Unicode.

Required
LENGTHINCHARFORDIAGRECW

If enabled, the SQLGetDiagRecW API treats the BufferLength parameter as the number of characters.

Default is: FALSE (disabled)

For more information about using the BufferLength parameter seeBufferLength in character for SQLGetDiagRecW.

LEAVE_TRAILING_SPACES If enabled, the driver preserves blank characters at the end of VARCHAR/LVARCHAR column results.
Possible values are:
  • 0 (trim trailing spaces)
  • 1 (preserve trailing spaces)
Default value is: 0
The following example shows the configuration for a DSN called EmpInfo:
[EmpInfo] 
Driver=/informix/lib/cli/iclis09b.so 
Description=Demo data source 
Database=odbc_demo 
LogonID=admin 
pwd=tiger 
Server=ifmx_91 
CLIENT_LOCALE=en_us.8859-1 
DB_LOCALE=en_us.8859-1 
TRANSLATIONDLL=/opt/informix/lib/esql/igo4a304.so
The following example shows the configuration for a DSN called HCL OneDB 9:
[Informix9] 
Driver=/work/informix/lib/cli/iclis09b.so 
Description=Informix 9.x ODBC Driver 
LogonID=user1 
pwd=tigress4 
Database=odbc_demo 
ServerName=my_server 
If you specify a null LogonID or pwd, the following error occurs:
Insufficient connect information supplied
Tip: You can establish a connection to a DSN with null values for LogonID and pwd if the local HCL OneDB database server is on the same computer where the client is located. In this case, the current user is considered a trusted user.
A sample data source, with no LogonID and pwd, where the server and client are on the same computer, might look like the following example:
Driver=/work/informix/lib/cli/iclis09b.so 
Description=Informix 9.x ODBC Driver 
LogonID= 
pwd=tiger 
Database=odbc_demo 
ServerName=ifmx_server