The odbc.ini file is a sample data-source configuration information file. For the location of odbc.ini file, see the release notes. To create this file, copy odbc.ini to your home directory as $HOME/.odbc.ini (note the added dot at the beginning of the filename). Every DSN to which your application connects must have an entry in this file. The following table describes the sections in $HOME/.odbc.ini.
Section | Description | Status |
---|---|---|
ODBC Data Sources | This section lists the DSNs and associates them with the name of the driver. You need to provide this section only if you use an ODBC driver manager from a third-party vendor. | Required |
Data Source Specification | Each DSN listed in the ODBC Data Sources section has a Data-Source Specification section that describes the DSN. | Required |
ODBC | This section lists ODBC tracing options. | Optional |
Each entry in the ODBC Data Sources section lists a DSN and the driver name. The data_source_name value is any name that you choose. It is like an envelope that contains all relevant connection information about the DSN.
The following example illustrates an ODBC data-source format:
[ODBC Data Sources] data_source_name=INFORMIX ODBC 3.81 Driver
·
·
·
The following example defines two DSNs called EmpInfo and CustInfo:
[ODBC Data Sources] EmpInfo=IINFORMIX ODBC 3.81 Driver CustInfo=INFORMIX-CLI 2.8 Driver
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 [ODBC] UNICODE=unicode_type
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 | Path for the driver
Set this value to the complete pathname for the driver library. For more information on the library directory and filenames, see the release notes. |
Required |
data_source_description | Description of the DSN
Configured for a single user or for system users. |
Optional |
database_name | Database to which the DSN connects by default | Required |
user_id | User identification or account name for access to the DSN | Optional |
user_password | Password for access to the DSN | Optional |
database_server | Informix database server on which database_name resides | Required |
application_locale (GLS only) | Client locale.
Default value: en_us.8859-1 |
Optional |
database_locale (GLS only) | Database locale. Default value: en_us.8859-1 | Optional |
translation_path (GLS only) | DLL that performs code-set conversion; default
value:
$INFORMIXDIR/lib/esql/ig04a304.xx, where xx represents a platform-specific file extension |
Optional |
cursor_behavior_name | Flag for cursor behavior when a commit or rollback transaction
is called.
Possible values are:
Default value: 0 |
Optional |
default_UDT_Fetch_type | Default UDT fetch type.
Default value: SQL_C_BINARYPossible values are:
|
Optional |
Enable_scroll_cursors | If this option is activated, the IBM Informix 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: EnableScrollableCursorsDefault value is: 0 (disabled) |
Optional |
Enable_insert_cursors | Reduces the number of network messages sent to
and from the server by buffering the inserted rows used with arrays
or 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 |
optimize_auto_commit | 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 |
open_fetch_close_optimization | Causes the driver to buffer the open, fetch,
and close cursor messages to the server. This option eliminates
on 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 |
Report_keyset_cursors | Causes the driver to report (via 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 |
fetchbuffer_size | Size of a fetch buffer in bytes.
Available as connection attribute string: FETCHBUFFERSIZE Default is: 4096 |
Optional |
describe_decimal_as_float | Describes all floating-point decimal columns
as:
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 can not 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 will be described as SQLREAL. With a precision greater than 8, it is described as SQL_DOUBLE. Available as connection attribute string: DESCRIBEDECIMALFLOATPOINT Default is: 0 (disabled) |
Optional |
use_server_dblocale | Users server database locale.
Available as a connection attribute string: USERSERVERDBLOCALE Default is: 0 (disabled) |
Optional |
do_not_use_lvarchar | If enabled, the SQLGetTypeInfo does
not report LVARCHAR as a supported type (DATA_TYPE) of SQL_VARCHAR.
Some applications will 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. A large number of
LVARCHAR columns can result in the rowset size exceeding the maximum.
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 |
char_col_as_widechar_col | Causes SQLDescribeCol to report character columns
as wide character columns as follows:
Available as a connection attribute string: REPORTCHARCOLASWIDECHARCOL Default is: 0 (disabled) |
Optional |
unicode_type | Indicates the type of Unicode used by an application.
This attribute is applies to UNIX applications only and is set in the
ODBC section of the odbc.ini file. The following considerations
apply:
Default is: UTF-8 For more information on using Unicode in an ODBC application, see Unicode. |
Required |
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 Informix 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
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_serverHome | [ Top of Page | Previous Page | Next Page | Contents | Index ]