Data Source Configuration
In the UNIX and Linux environments, a system information file is used to store data source information. Setup installs a default version of this file, called odbc.ini, in the product installation directory (see "ODBCINI" for details about relocating and renaming this file). This is a plain text file that contains data source definitions.
If you have a Motif graphical user interface (GUI) in your UNIX or Linux environment, you can use the DataDirect ODBC Data Source Administrator for UNIX/Linux (the UNIX ODBC Administrator) to create or modify data source definitions in this file (see "Configuration Through the UNIX ODBC Administrator" for details). On Linux, you can determine if you are using Motif through the following command:
The rpm command returns output similar to:
Commands for determining whether Motif is installed vary among UNIX systems. Please refer to your operating system documentation for details specific to your system.
If you are not using a GUI, you can use any text editor to create or modify data source definitions directly in the system information file. See "Configuration Through the System Information File" for details.
Configuration Through the UNIX ODBC Administrator
The UNIX ODBC Administrator is located in the /tools directory of the product installation directory. For example,
To configure a data source:
- To start the UNIX ODBC Administrator, change to the
install_dir/tools directory, whereinstall_diris the path to the product installation directory. At a command prompt, enterodbcadmin
The Administrator dialog box appears.
- Click either the User DSN or File DSN tab to display a list of data sources.
- User DSN: If you are configuring an existing user data source, select the appropriate data source name and click Configure to display the driver Setup dialog box.
If you are configuring a new user data source, click Add to display a list of installed drivers. Select the appropriate driver and click Finish to display the driver Setup dialog box.
- File DSN: If you are configuring an existing file data source, select the appropriate data source file and click Configure to display the driver Setup dialog box.
To configure a new file data source, click Add to display a list of installed drivers. Select the appropriate driver and click Advanced to specify attributes; otherwise, click Next to proceed. Specify a name for the data source and click Next. Verify the data source information; then, click Finish to display the driver Setup dialog box.
NOTE: If you want to set a default directory for File DSNs, select the directory from the Directories list; then, click Set Directory. The next time that you open the Administrator, it displays data source files from this directory.
The General tab of the driver Setup dialog box appears by default.
See the individual driver chapters for specific information about the driver Setup dialog. See "Quick Start Connect" for an explanation of different types of data sources.
Drivers
The Drivers tab shows a list of all installed ODBC drivers.
Tracing
ODBC tracing allows you to trace calls to ODBC drivers and create a log of the traces for troubleshooting purposes.
You enable tracing by selecting the Enable Tracing check box on the Tracing tab of the Administrator. Clear the check box to disable tracing. Tracing continues until you disable it. Be sure to turn off tracing when you are finished reproducing the issue because tracing decreases the performance of your ODBC application.
To specify the path and name of the trace log file, type the path and name in the Trace File field or click Browse to select a log file. If no location is specified, the trace log resides in the working directory of the application you are using.
DataDirect ships a default shared object, odbctrac.so, to perform tracing. If you want to use a custom shared object instead, type the path and name of the shared object in the Trace Library field or click Browse to select a shared object.
After making changes on the Trace tab, click Apply for them to take effect.
For a more complete discussion of tracing, refer to "ODBC Trace" in Chapter 1 of the DataDirect Connect for ODBC and Connect XE for ODBC Troubleshooting Guide
When you are finished with the UNIX ODBC Administrator, click OK or Cancel. If you click OK, any changes you have made to the Trace tab are accepted and the Administrator closes. If you click Cancel, the Administrator closes without saving any changes.
Configuration Through the System Information File
To configure a data source manually, you edit the system information file with a text editor. The content of this file is divided into three sections.
At the beginning of the file is a section named
[ODBC Data Sources]containingdata_source_name=installed-driverpairs, for example:The driver uses this section to match a data source to the appropriate installed driver.
The
[ODBC Data Sources]section also includes data source definitions. The default odbc.ini contains a data source definition for each driver. Each data source definition begins with a data source name in square brackets, for example,[Oracle Wire Protocol]. The data source definitions contain connection string attribute=value pairs with default values. You can modify these values as appropriate for your system. Descriptions of these attributes are in each individual driver chapter.The second section of the file is named
[ODBC File DSN]and includes one keyword:This keyword defines the path of the default location for file data sources (see "File Data Sources").
NOTE: This section is not included in the default odbc.ini that is installed by the product installer. You can add this section manually or, if you are using the UNIX ODBC Administrator, it will be added automatically when you click Set Directory on the File DSN tab (see Step 2 under "Configuration Through the UNIX ODBC Administrator").
The third section of the file is named
[ODBC]and includes several keywords:[ODBC] IANAAppCodePage=4 InstallDir=ODBCHOME Trace=0 TraceFile=odbctrace.out TraceDll=ODBCHOME/lib/odbctrac.soThe IANAAppCodePage keyword defines the default value that all UNIX/Linux drivers use if individual data sources have not specified a different value. See the individual driver chapters and refer to "Values for the Attribute IANAAppCodePage" in the DataDirect Connect for ODBC and Connect XE for ODBC Reference for details. The default value is 4.
The InstallDir keyword must be included in this section. The value of this keyword is the path to the installation directory under which the /lib and /messages directories are contained. The installation process automatically writes your installation directory to the default odbc.ini.
For example, if you choose an installation location of /opt/odbc, then the following line is written to the
[ODBC]section of the default odbc.ini:NOTE: If you are using only DSN-less connections through an odbcinst.ini file and do not have an odbc.ini file, then you must provide
[ODBC]section information in the[ODBC]section of the odbcinst.ini file. The drivers and Driver Manager always check first in the[ODBC]section of an odbc.ini file. If no odbc.ini file or[ODBC]section exists, they check for an[ODBC]section in the odbcinst.ini file. See "DSN-less Connections" for details.Tracing
ODBC tracing allows you to trace calls to ODBC drivers and create a log of the traces for troubleshooting purposes.
The [ODBC] section of the system information file includes three keywords related to tracing: Trace, TraceFile, and TraceDll. For example:
In this example, tracing is enabled, trace information is logged in a file named odbctrace.out, and odbctrac.so performs the tracing.
You enable tracing by setting the value of Trace to 1. Set the value to 0 to disable tracing. Tracing continues until you disable it. Be sure to turn off tracing when you are finished reproducing the issue because tracing decreases the performance of your ODBC application.
To specify the path and name of the trace log file, enter it as the value for TraceFile. If no location is specified, the trace log resides in the working directory of the application you are using.
DataDirect ships a default shared object, odbctrac.so, to perform tracing. If you want to use a custom shared object instead, enter the path and name of the shared object as the value for TraceDll.
For a more complete discussion of tracing, refer to "ODBC Trace" in Chapter 1 of the DataDirect Connect for ODBC and Connect XE for ODBC Troubleshooting Guide.
See "Sample Default System Information File" for an example of the default odbc.ini file.
Sample Default System Information File
The following is a sample odbc.ini file that Setup installs in the installation directory. All occurrences of ODBCHOME are replaced with your installation directory path during installation of the file. Values that you must supply are enclosed by angle brackets (< >). If you are using the installed odbc.ini file, you must supply the values and remove the angle brackets before that data source section will operate properly. Commented lines are denoted by the # symbol.
DB2 Wire Protocol=DataDirect 5.3 DB2 Wire Protocol dBASE=DataDirect 5.3 dBASEFile(*.dbf) FoxPro3=DataDirect 5.3 dBASEFile(*.dbf) Informix Wire Protocol=DataDirect 5.3 Informix Wire Protocol Informix=DataDirect 5.3 Informix Oracle Wire Protocol=DataDirect 5.3 Oracle Wire Protocol Oracle=DataDirect 5.3 Oracle SQLServer Wire Protocol=DataDirect 5.3 SQL Server Wire Protocol Sybase Wire Protocol=DataDirect 5.3 Sybase Wire Protocol Teradata=DataDirect 5.3 Teradata Text=DataDirect 5.3 TextFile(*.*) [DB2 Wire Protocol] Driver=ODBCHOME/lib/ivdb223.so Description=DataDirect 5.3 DB2 Wire Protocol AddStringToCreateTable= AlternateID= AlternateServers= ApplicationUsingThreads=1 AuthenticationMethod=0 CatalogSchema= CharsetFor65535=0 #Collection applies to z/OS and iSeries only Collection= ConnectionRetryCount=0 ConnectionRetryDelay=3 #Database applies to DB2 UDB only Database=<database_name> DefaultIsolationLevel=1 DynamicSections=200 EncryptionMethod=0 GrantAuthid=PUBLIC GrantExecute=1 GSSClient=native HostNameInCertificate= IpAddress=<DB2_server_host> LoadBalancing=0 #Location applies to z/OS and iSeries only Location=<location_name> LogonID= Password= PackageCollection=NULLID PackageOwner= ReportCodePageConversionErrors=0 TcpPort=50000 TrustStore= TrustStorePassword= UseCurrentSchema=1 ValidateServerCertificate=1 WithHold=1 XMLDescribeType=-10 [dBASE] Driver=ODBCHOME/lib/ivdbf23.so Description=DataDirect 5.3 dBASEFile(*.dbf) ApplicationUsingThreads=1 CacheSize=4 CreateType=dBASE5 Database=ODBCHOME/demo DataFileExtension=DBF ExtensionCase=UPPER FileOpenCache=0 IntlSort=0 LockCompatibility=dBASE Locking=RECORD UseLongNames=0 UseLongQualifiers=0 [FoxPro3] Driver=ODBCHOME/lib/ivdbf23.so Description=DataDirect 5.3 dBASEFile(*.dbf) ApplicationUsingThreads=1 CacheSize=4 CreateType=FoxPro30 Database=ODBCHOME/demo DataFileExtension=DBF ExtensionCase=UPPER FileOpenCache=0 IntlSort=0 LockCompatibility=Fox Locking=RECORD UseLongNames=0 UseLongQualifiers=0 [Informix Wire Protocol] Driver=ODBCHOME/lib/ivifcl23.so Description=DataDirect 5.3 Informix Wire Protocol AlternateServers= ApplicationUsingThreads=1 CancelDetectInterval=0 ConnectionRetryCount=0 ConnectionRetryDelay=3 Database=<database_name> HostName=<Informix_host> LoadBalancing=0 LogonID= Password= PortNumber=<Informix_server_port> ServerName=<Informix_server> TrimBlankFromIndexName=1 UseDelimitedIdentifiers=0 [Informix] Driver=ODBCHOME/lib/ivinf23.so Description=DataDirect 5.3 Informix ApplicationUsingThreads=1 CancelDetectInterval=0 CursorBehavior=0 Database=<database_name> EnableInsertCursors=0 GetDBListFromInformix=1 HostName=<Informix_host> LogonID= Password= Protocol=onsoctcp ServerName=<Informix_server> Service=<Informix_service_name> TrimBlankFromIndexName=1 [Oracle Wire Protocol] Driver=ODBCHOME/lib/ivora23.so Description=DataDirect 5.3 Oracle Wire Protocol AlternateServers= ApplicationUsingThreads=1 ArraySize=60000 AuthenticationMethod=1 CachedCursorLimit=32 CachedDescLimit=0 CatalogIncludesSynonyms=1 CatalogOptions=0 ConnectionRetryCount=0 ConnectionRetryDelay=3 DefaultLongDataBuffLen=1024 DescribeAtPrepare=0 EnableDescribeParam=0 EnableNcharSupport=0 EnableScrollableCursors=1 EnableStaticCursorsForLongData=0 EnableTimestampWithTimeZone=0 EncryptionMethod=0 GSSClient=native HostName=<Oracle_server> HostNameInCertificate= KeyPassword= KeyStore= KeyStorePassword LoadBalancing=0 LocalTimeZoneOffset= LockTimeOut=-1 LogonID= Password= PortNumber=<Oracle_server_port> ProcedureRetResults=0 ReportCodePageConversionErrors=0 ReportRecycleBin=0 ServerName=<server_name in tnsnames.ora> ServerType=0 ServiceName= SID=<Oracle_System_Identifier> TimestampeEscapeMapping=0 TNSNamesFile=<tnsnames.ora_filename> TrustStore= TrustStorePassword= UseCurrentSchema=1 ValidateServerCertificate=1 WireProtocolMode=1 [Oracle] Driver=ODBCHOME/lib/ivor823.so Description=DataDirect 5.3 Oracle AlternateServers= ApplicationUsingThreads=1 ArraySize=60000 CatalogIncludesSynonyms=1 CatalogOptions=0 ClientVersion=9iR2 ConnectionRetryCount=0 ConnectionRetryDelay=3 DefaultLongDataBuffLen=1024 DescribeAtPrepare=0 EnableDescribeParam=0 EnableNcharSupport=0 EnableScrollableCursors=1 EnableStaticCursorsForLongData=0 EnableTimestampWithTimeZone=0 LoadBalancing=0 LocalTimeZoneOffset= LockTimeOut=-1 LogonID= OptimizeLongPerformance=0 Password= ProcedureRetResults=0 ReportCodePageConversionErrors=0 ReportRecycleBin=0 ServerName=<Oracle_server> TimestampEscapeMapping=0 UseCurrentSchema=1 [SQL Server Wire Protocol] Driver=ODBCHOME/lib/ivmsss23.so Description=DataDirect 5.3 SQL Server Wire Protocol Address=<SQLServer_host, SQLServer_server_port> AlternateServers= AnsiNPW=Yes ConnectionRetryCount=0 ConnectionRetryDelay=3 Database=<database_name> LoadBalancing=0 LogonID= Password= QuotedId=No SnapshotSerializable=0 [Sybase Wire Protocol] Driver=ODBCHOME/lib/ivase23.so Description=DataDirect 5.3 Sybase Wire Protocol AlternateServers= ApplicationName= ApplicationUsingThreads=1 ArraySize=50 AuthenticationMethod=0 Charset= ConnectionRetryCount=0 ConnectionRetryDelay=3 CursorCacheSize=1 Database=<database_name> DefaultLongDataBuffLen=1024 EnableDescribeParam=0 EnableQuotedIdentifiers=0 EncryptionMethod=0 GSSClient=native HostNameInCertificate= InitializationString= Language= LoadBalancing=0 LogonID= NetworkAddress=<Sybase_host,Sybase_server_port> OptimizePrepare=1 PacketSize=0 Password= RaiseErrorPositionBehavior=0 ReportCodePageConversionErrors=0 SelectMethod=0 ServicePrincipalName= TruncateTimeTypeFractions=0 TrustStore= TrustStorePassword= ValidateServerCertificate=1 WorkStationID= [Teradata] Driver=ODBCHOME/lib/ivtera23.so Description=DataDirect 5.3 Teradata AccountString= AuthenticationDomain= AuthenticationPassword= AuthenticationUserid= CharacterSet=ASCII DBCName=<Teradata_server> Database= EnableDataEncryption=0 EnableExtendedStmtInfo=0 EnableLOBs=1 EnableReconnect=0 IntegratedSecurity=0 LoginTimeout=20 LogonID= MapCallEscapeToExec=0 MaxRespSize=8192 Password= PortNumber=1025 PrintOption=N ProcedureWithSplSource=Y ReportCodePageConversionErrors=0 SecurityMechanism= SecurityParameter= ShowSelectableTables=1TDProfile= TDRole= TDUserName= [Text] Driver=ODBCHOME/lib/ivtxt23.so Description=DataDirect 5.3 TextFile(*.*) AllowUpdateAndDelete=0 ApplicationUsingThreads=1 CacheSize=4 CenturyBoundary=20 Database=ODBCHOME/demo DataFileExtension=TXT DecimalSymbol=. Delimiter= FileOpenCache=0 FirstLineNames=0 IntlSort=0 ScanRows=25 TableType=Comma UndefinedTable=GUESS [ODBC] IANAAppCodePage=4 InstallDir=ODBCHOME Trace=0 TraceFile=odbctrace.out TraceDll=ODBCHOME/lib/odbctrac.soTo modify or create data sources in the default system information file, use the following procedures.
To modify a data source:
- Using a text editor, open the odbc.ini file.
- Modify the default attributes in the data source definitions as necessary based on your system specifics, for example, enter the server name and port number of your system in the appropriate location.
Consult the "Connection String Attributes" table of each driver chapter for other specific attribute values.
- After making all modifications, save the odbc.ini file and close the text editor.
IMPORTANT: The "Connection String Attributes" table of each driver chapter lists both the long and short name of the attribute. When entering attribute names into odbc.ini, you must use the long name of the attribute. The short name is not valid in the odbc.ini file.
To create a new data source:
- Using a text editor, open the odbc.ini file.
- Copy an appropriate existing default data source definition and paste it to another location in the file.
- Change the data source name in the copied data source definition to a new name. The data source name is between square brackets at the beginning of the definition, for example,
[Oracle Wire Protocol].- Modify the attributes in the new definition as necessary based on your system specifics, for example, enter the server name and port number of your system in the appropriate location.
Consult the "Connection String Attributes" table of each driver chapter for other specific attribute values.
- In the
[ODBC]section at the beginning of the file, add a new data_source_name=installed-driver pair containing the new data source name and the appropriate installed driver name.- After making all modifications, save the odbc.ini file and close the text editor.
IMPORTANT: The "Connection String Attributes" table of each driver chapter lists both the long and short name of the attribute. When entering attribute names into odbc.ini, you must use the long name of the attribute. The short name is not valid in the odbc.ini file.
Translators
DataDirect provides a sample translator named "OEM to ANSI" that provides a framework for coding a translation library. Refer to the readme.trn file in the /src/trn subdirectory in the product installation directory for details.
To perform a translation with a particular driver, you must include the TranslationSharedLibrary keyword in that driver's data source definition in the odbc.ini file. The TranslationSharedLibrary keyword represents the full path to the translation library.
For example:
[DB2] Driver=ODBCHOME/lib/ivdb223.so Description=DataDirect 5.3 DB2 Wire Protocol TranslationSharedLibrary=ODBCHOME/lib/ivtrn23.soThe TranslationOption keyword is the ASCII representation of the 32-bit integer translation option. Use of the TranslationOption keyword is optional.
The final step is to verify that the driver connects and passes SQL.