Advanced configuration for Oracle
Optional features of the Oracle drivers, each with its own settings.
Advanced configuration for Oracle
Optional features of the Oracle drivers, each with its own settings.
Configure Oracle Connection Pooling
Configure Oracle Connection Pooling
Use the following instructions to configure Oracle Connection Pooling:
Single-Tier (Lite) Windows
1. Log in to the machine that hosts OpenLink's Single-Tier (Lite Drivers).
2. Launch your ODBC Data Sources Administrator.
3. Locate your OpenLink DSN.
4. Click the Configure button.
5. Scroll through the configuration screens until you find the "Enable OC Connection Pooling" checkbox.
6. Check the Pooling checkbox to create a separate connection pool for each Oracle instance to which you connect.
7. Configure the rest of the fields related to Pooling:
- Minimum Pool Size - The minimum number of connections to be opened when the pool is created.
- Maximum Pool Size - The maximum number of connections that can be opened in the pool.
- Increment - The incremental number of connections to be opened when all the connections are busy and a call needs a connection.
- Linger time - The amount of time to wait for a connection when all connections are busy and the maximum number of open connections has been reached.
- Wait for free connection - The length of time the last connection in the pool should linger before the pool is destroyed.
Making Connections through the Oracle Instant Client
Our Single-Tier "Lite" Edition drivers and Multi-Tier "Enterprise" Edition database agents can communicate with remote Oracle databases through the Oracle Instant Client libraries.
Instant Client allows you to run applications without installing the full Oracle client (SQL*Net or Net8/9/10/11) or having an ORACLE_HOME.
It supports two basic connection string formats:
-
[username[:password]@]//host[:port][/service name], e.g.//dbase-server-5:4321/ORDERS
- an Oracle Net keyword-value pair such as
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=dlsun242)
(PORT=5521)) (CONNECT_DATA=(SERVICE_NAME=bjava21)))
Naming methods that use a configuration file (such as tnsnames.ora or sqlnet.ora) for name translation are also possible, if the environment variable TNS_ADMIN is set to point to the directory containing the file.
Oracle documentation:
Additionally, the ORACLE_HOME and relevant library path variables must point to the root of the Oracle Instant Client installation.
These variables appear in the environment and various configuration files.
Follow the instructions appropriate to your driver and OS, to ensure that your environment and configuration files are properly configured.
Single-Tier
Single-Tier on a Unix-like OS
- Log in to your client machine.
- Use the sh or bash command to open a bourne or bash shell.
- cd into the root of your Single-Tier driver installation.
- Execute this command:
. ./openlink.sh
- Execute this command:
echo $ORACLE_HOME
- Use export to set
ORACLE_HOMEto the root of your local Instant Client Installation, as needed.
- Use the echo command to display your library path.
For example:
- AIX:
echo $LIBPATH
- HP-UX:
echo $SHLIB_PATH
- Other:
echo $LD_LIBRARY_PATH
- AIX:
- Use export to append the root of the Instant Client installation to your library path, as needed.
- cd into the bin sub-directory of your Single-Tier driver installation.
- Use a text editor to open the
openlink.inifile.
- Locate the
[Environment Oracle]section that applies to you. For example:
INI [Environment Oracle 9.x] ORACLE_HOME = /dbs3/oracle/oracle9i/32bit/v9.2.0.1.0 ORACLE_SID = ora9264 ;ORACLE_SERVER = T ;TWO_TASK = P: ;ODBC_CATALOGS = Y ; Uncomment after loading odbccat9.sql ;MULTIPLEX_LDA = 5 ; Allow 5 OpenLink clients on a single lda ;OPL_USR_TBLS_FIRST = Y ; Sort SQLTables starting with user tables SHOW_REMARKS = N ; Retrieve SQLColumns REMARKS field CURSOR_SENSITIVITY = LOW ; Set to HIGH after loading odbccat9.sql ;OCI_PREFETCH_ROWS = 100 ; Number of rows to prefetch ;OCI_PREFETCH_MEMORY = 65535 ; Amount of memory to use for prefetching ;NLS_LANG = AMERICAN_AMERICA.UTF8 ; Unicode connection [Environment Oracle 10.x] ORACLE_HOME = /dbs3/oracle/instantclient_10_2 ORACLE_SID = ora10g64 ;ORACLE_SERVER = T ;TWO_TASK = P: ;ODBC_CATALOGS = Y ; Uncomment after loading odbccat10.sql ;MULTIPLEX_LDA = 5 ; Allow 5 OpenLink clients on a single lda ;OPL_USR_TBLS_FIRST = Y ; Sort SQLTables starting with user tables SHOW_REMARKS = N ; Retrieve SQLColumns REMARKS field CURSOR_SENSITIVITY = LOW ; Set to HIGH after loading odbccat10.sql ;OCI_PREFETCH_ROWS = 100 ; Number of rows to prefetch ;OCI_PREFETCH_MEMORY = 65535 ; Amount of memory to use for prefetching ;NLS_LANG = AMERICAN_AMERICA.UTF8 ; Unicode connection
- Pass the root of your Instant Client installation as
ORACLE_HOME.
- Save your changes and exit the file.
Single-Tier on Windows
- Log in to your client machine.
- Expand the Windows Control Panel.
- Locate the System utility.
- Click on the Advanced tab.
- Click the Environment button.
- Scroll through the User and System variables.
- Set an ORACLE_HOME variable that points to the root of the local Instant Client installation, if it does not exist.
- Add the root of the Instant Client installation to PATH, if it is not already present.
- Exit the System utility.
Multi-Tier
Multi-Tier with Oracle Database Agent on a Unix-like OS
- Log in to the machine that contains your Multi-Tier server components.
- Use the sh or bash command to open a bourne or bash shell.
- cd into the root of your Multi-Tier installation.
- Execute this command:
. ./openlink.sh
- Execute this command:
echo $ORACLE_HOME
- Use export to set
ORACLE_HOMEto the root of your local Instant Client Installation, as needed.
- Use the echo command to display your library path.
For example:
- AIX:
echo $LIBPATH
- HP/UX:
echo $SHLIB_PATH
- Other:
echo $LD_LIBRARY_PATH
- AIX:
- Use export to append the root of the Instant Client installation to your library path, as needed.
- cd into the bin sub-directory of your Multi-Tier installation.
- Use a text editor to open the
oplrqb.inifile.
- Locate the
[Environment ORACLE]section that applies to you. For example:
INI [Environment ORACLE90] ORACLE_HOME = /dbs3/oracle/oracle9i/32bit/v9.2.0.1.0 ORACLE_SID = ora9264 ;ORACLE_SERVER = T ;TWO_TASK = P: ;ODBC_CATALOGS = Y ; Uncomment after loading odbccat9.sql ;MULTIPLEX_LDA = 5 ; Allow 5 OpenLink clients on a single lda ;OPL_USR_TBLS_FIRST = Y ; Sort SQLTables starting with user tables SHOW_REMARKS = N ; Retrieve SQLColumns REMARKS field CURSOR_SENSITIVITY = LOW ; Set to HIGH after loading odbccat9.sql ;OCI_PREFETCH_ROWS = 100 ; Number of rows to prefetch ;OCI_PREFETCH_MEMORY = 65535 ; Amount of memory to use for prefetching LD_LIBRARY_PATH = /dbs3/oracle/oracle9i/32bit/v9.2.0.1.0/lib ;SHLIB_PATH = ;LIBPATH = /dbs/oracle81/lib ; Find AIX shared libraries ;NLS_LANG = AMERICAN_AMERICA.UTF8 ; Uncomment for Unicode connections [Environment ORACLE100] ORACLE_HOME = /dbs3/oracle/instantclient_10_2 ORACLE_SID = ora10g64 ;ORACLE_SERVER = T ;TWO_TASK = P: ;ODBC_CATALOGS = Y ; Uncomment after loading odbccat10.sql ;MULTIPLEX_LDA = 5 ; Allow 5 OpenLink clients on a single lda ;OPL_USR_TBLS_FIRST = Y ; Sort SQLTables starting with user tables SHOW_REMARKS = N ; Retrieve SQLColumns REMARKS field CURSOR_SENSITIVITY = LOW ; Set to HIGH after loading odbccat10.sql ;OCI_PREFETCH_ROWS = 100 ; Number of rows to prefetch ;OCI_PREFETCH_MEMORY = 65535 ; Amount of memory to use for prefetching ;LD_LIBRARY_PATH = /dbs/oracle100/lib ; Find shared libraries ;SHLIB_PATH = /dbs/oracle100/lib ; Find HP/UX shared libraries ;LIBPATH = /dbs/oracle100/lib ; Find AIX shared libraries ;NLS_LANG = AMERICAN_AMERICA.UTF8 ; Uncomment for Unicode connections
- Pass the root of your Instant Client installation to
ORACLE_HOME.
- Pass the root of your Instant Client installation to the relevant library path variable.
- Ensure no semicolon appears in front of the relevant library path variable.
- Save your changes and exit the file.
- Start or restart the OpenLink Request Broker service.
For example:
Shell ./oplshut -fy ./oplrqb +loglevel 7 +logfile oplrqb.log
Multi-Tier with Oracle Database Agent on a Windows host
- Log in to the machine that contains your Multi-Tier server components installation.
- Expand the Windows Control Panel.
- Locate the System utility.
- Click on the Advanced tab.
- Click the Environment button.
- Scroll through the User and System variables.
- Set an
ORACLE_HOMEvariable that points to the root of the Instant Client installation, if it does not exist.
- Add the root of the Instant Client installation to
PATH, if it is not already present.
- Exit the System utility.
- Use Notepad to open the
oplrqb.inifile that appears in the bin sub-directory of the Multi-Tier installation.
- Locate the
[Environment ORACLE]section that applies to you. For example:
INI [Environment ORACLE90] ORACLE_HOME = /dbs3/oracle/oracle9i/32bit/v9.2.0.1.0 ORACLE_SID = ora9264 ;ORACLE_SERVER = T ;TWO_TASK = P: ;ODBC_CATALOGS = Y ; Uncomment after loading odbccat9.sql ;MULTIPLEX_LDA = 5 ; Allow 5 OpenLink clients on a single lda ;OPL_USR_TBLS_FIRST = Y ; Sort SQLTables starting with user tables SHOW_REMARKS = N ; Retrieve SQLColumns REMARKS field CURSOR_SENSITIVITY = LOW ; Set to HIGH after loading odbccat9.sql ;OCI_PREFETCH_ROWS = 100 ; Number of rows to prefetch ;OCI_PREFETCH_MEMORY = 65535 ; Amount of memory to use for prefetching LD_LIBRARY_PATH = /dbs3/oracle/oracle9i/32bit/v9.2.0.1.0/lib ;SHLIB_PATH = ;LIBPATH = /dbs/oracle81/lib ; Find AIX shared libraries ;NLS_LANG = AMERICAN_AMERICA.UTF8 ; Uncomment for Unicode connections [Environment ORACLE100] ORACLE_HOME = /dbs3/oracle/instantclient_10_2 ORACLE_SID = ora10g64 ;ORACLE_SERVER = T ;TWO_TASK = P: ;ODBC_CATALOGS = Y ; Uncomment after loading odbccat10.sql ;MULTIPLEX_LDA = 5 ; Allow 5 OpenLink clients on a single lda ;OPL_USR_TBLS_FIRST = Y ; Sort SQLTables starting with user tables SHOW_REMARKS = N ; Retrieve SQLColumns REMARKS field CURSOR_SENSITIVITY = LOW ; Set to HIGH after loading odbccat10.sql ;OCI_PREFETCH_ROWS = 100 ; Number of rows to prefetch ;OCI_PREFETCH_MEMORY = 65535 ; Amount of memory to use for prefetching ;LD_LIBRARY_PATH = /dbs/oracle100/lib ; Find shared libraries ;SHLIB_PATH = /dbs/oracle100/lib ; Find HP/UX shared libraries ;LIBPATH = /dbs/oracle100/lib ; Find AIX shared libraries ;NLS_LANG = AMERICAN_AMERICA.UTF8 ; Uncomment for Unicode connections
- Pass the root of your Instant Client installation to
ORACLE_HOME.
- Pass the root of your Instant Client installation to the relevant library path variable.
- Ensure no semicolon appears in front of the relevant library path variable.
- Save your changes and exit the file.
- Open your Windows Control Panel.
- Locate the Services utility.
(It may be in the Administrative Tools sub-folder.)
- Launch Services.
- Locate the OpenLink Request Broker Service in the list box.
- Restart the OpenLink Request Broker service.
ODBC to Jet Data Type Mapping for Oracle
The following table details how the OpenLink drivers for Oracle fetch numeric data.
The SQL type reported for a SELECT column varies depending on the native Oracle type of the column, its precision, and its scale.
The OpenLink C type used to fetch the data is also shown, together with the effect of the JetFix command line switch.
Changes to the type mappings are shown in the table as italics.
{Notes} on the above table
-
FLOAT(b)specifies a floating point number with binary precisionb. The precision can range from 1 to 126. To convert from binary to decimal precision, multiplybby 0.30103.
- Possible loss of precision
-
FLOATspecifies a floating point number with decimal precision 38, or a binary precision of 126.
-
NUMBERspecifies a floating point number with decimal precision=38.
- Oracle appears to return s
=0, p=0 for a calculated field
- Oracle permits a maximum precision of 38.
Precision of OpenLink C Types
The choice of OpenLink C type used to fetch a numeric value is determined by the maximum precision supported by the type.
If a numeric type exists which can represent the data to be fetched without loss of precision, then this is used as the preferred fetch type.
If a numeric type capable of supporting the required precision does not exist, then the data is fetched in character form, unless the JetFix switch is on.
In this case, the data is fetched using the CTYPE_FLT64 fetch type.
This type has sufficient range to store the maximum numeric values supported by Oracle, but its use may result in a loss of precision, if the precision of the data to be fetched exceeds 15 decimal digits.
Oracle Real Application Clustering
What is Real Application Clustering?
Oracle Real Application Clustering (RAC) uses Transparent Application Failover (TAF) which is a protocol within Oracle whereby, if a connection to a database node fails, it can be re-established against an alternative node.
Once a broken connection has failed-over, an application can continue without any special action on its part. However, TAF does not restore all facets of a connection. For instance, TAF does not:
- restore active transactions - any active transactions are rolled back at the time of failure because TAF cannot preserve active transactions after failover: the application instead receives an error message until a
ROLLBACKis submitted
- restore session properties set using '
ALTER SESSION'
- maintain the state of server-side program variables, such as PL/SQL package states
If any of these situations apply to a failed connection, an application may need to take action following failover to return the connection fully to the desired state. In order to do this, the application may request to be notified when failover has occurred. Both the "Lite" Edition and the "Enterprise" Edition Generic Client provide this facility through TAF event notifications.
The "Lite" Edition ODBC Driver and the "Enterprise" Edition Database Agent both enable configuration of the failover retry interval and the maximum number of failover retries, in the event that failover is not successful on the first attempt.
How to Configure UDA to use Oracle Real Application Clustering
Single-Tier "Lite" Edition on Unix-like OS
- Log in to the machine that hosts the Single-Tier (Lite) drivers.
- Use a text editor to open the
openlink.ini($OPENLINKINI) file that resides in the bin sub-directory of the Single-Tier installation.
- Locate the
[Environment Oracle 10.x]section.
- Create and set the following two variables:
INI OPL_TAF_MAX_RETRIES = 10 ; This is the maximum number of times that the driver will retry the connection. OPL_TAF_RETRY_INTERVAL = 5 ; This is the number of seconds that the driver will wait between connection attempts.
- Save your changes and exit the file.
Single-Tier "Lite" Edition on Windows
- Log in to the machine that hosts the Single-Tier "Lite" Edition drivers.
- Launch your ODBC Data Sources Administrator.
- Locate the relevant DSN.
- Click the Configure button.
- Scroll through the configuration screens until you find the "Enable TAF" checkbox.
- Check the TAF checkbox to prompt the driver to attempt multiple failover connections to alternative DBMS nodes.
- Configure the rest of the fields related to TAF:
- Maximum Retries - This is the maximum number of times that the driver will retry the connection.
- Retry Interval (secs) - This is the number of seconds that the driver will wait between connection attempts.
- Maximum Retries - This is the maximum number of times that the driver will retry the connection.
Multi-Tier "Enterprise" Edition on any OS
- Log in to the machine that hosts the Multi-Tier server components installation.
- Use a text editor to open the
oplrqb.inifile that resides in the bin sub-directory of the Multi-Tier installation.
- Locate the
[Environment ORACLE10]section.
- Create and set the following two variables:
INI OPL_TAF_MAX_RETRIES = 10 ; This is the maximum number of times that the driver will retry the connection. OPL_TAF_RETRY_INTERVAL = 5 ; This is the number of seconds that the driver will wait between connection attempts.
- Save your changes and exit the file.
- Restart the Request Broker.
Programmatic Considerations
Our ODBC drivers notify ODBC applications that failover has occurred using two mechanisms: event call-backs and SQLSTATEs.
TAF Event Notification: Call-backs
An application can register a failover call-back routine by setting the proprietary connection attribute SQL_ATTR_EVENT_CALL-BACK (1280) on an open connection.
The routine's address is supplied as the value of SQLSetConnectAttr's ValuePtr argument.
The same call-back routine can be registered for more than one connection.
The call-back routine's signature must take the form:
void (*call-back) (oplevent_t oplEvent,
SQLHANDLE handle,
SQLUSMALLINT eventInfo)
where:
-
oplEventis an integer indicating the type of event which took place.
-
contextis an application-supplied ODBC handle identifying the context the event is taking place in.
-
eventInfois an unsigned integer code providing more information about the event. The values returned depend on the type of event.0signifies 'no further information available'
oplEvent
is of type oplevent_t, an enumerated type enumerating the types of events reported to event call-backs.
oplevent_t is defined as follows:
typedef enum
{
OPL_EV_NONE = 0,
OPL_EV_FAILOVER_SUCCESS = 16,
OPL_EV_FAILOVER_ABORT = 17
}
oplevent_t;
At the moment, only failover events are supported through the OPL_EV_FAILOVER_xxx event class.
Other types of event may be supported in the future using this call-back mechanism.
OPL_EV_FAILOVER_SUCCESS indicates that failover was successful, OPL_EV_FAILOVER_ABORT that failover was aborted.
context
is the ODBC handle (HDBC) of the connection for which the application wishes to receive event notifications.
This handle should be supplied to the ODBC driver when the call-back is registered, using another Oracle-specific connection attribute, SQL_ATTR_EVENT_CONTEXT (1281).
If this attribute is not set, the call-back receives SQL_NULL_HANDLE for the handle argument.
(If other event types are supported in the future, this attribute may accept other types of ODBC handle, e.g., handles of type SQL_HANDLE_STMT, depending on the scope of the event.)
eventInfo
is reserved for future use.
All failover events currently return 0.
TAF Event Notification: SQLSTATEs
In addition to being informed of failover through a call-back routine, an ODBC application also receives notification through SQLSTATEs.
After failover completes, the first ODBC call to return on the affected connection can return one of two proprietary SQLSTATEs, IM500 or IM501:
-
IM500denotes successful failover completion. If the ODBC call generated no other errors, the call returnsSQL_SUCCESS_WITH_INFOwithSQLSTATE IM500and is accompanied by the informational message "Failover completed". As usual, the SQLSTATE and diagnostic message can be retrieved usingSQLGetDiagRec().
-
IM501("Failover aborted") indicates failover was unsuccessful. A function returning this SQLSTATE returns with return codeSQL_ERROR.
If the ODBC call returning the failover SQLSTATE fails for some reason, a diagnostic record holding the failover SQLSTATE and message is appended to any diagnostic records already generated by the failing call.
In this case, even if failover was successful, a SQLSTATE IM500 may be accompanied by a function return code of SQL_ERROR.
For instance, if a transaction was open at the time failover took place, SQLExecute() may return SQL_ERROR with two diagnostic records, for example:
- DiagRec #1 ?
Example Native error: 25402 SQLSTATE: HY000 Message: [OpenLink][ODBC][Oracle Server]ORA-25402: transaction must roll back
- DiagRec #2 ?
Example Native error: 0 SQLSTATE: IM500 Message: [OpenLink][ODBC][Oracle Server]Failover completed.
Note: Failover notification using TAF-specific SQLSTATEs cannot be used independently of failover call-backs. The use of these SQLSTATEs is only triggered when an application registers a failover call-back.
Related Links
Configure Oracle Reference Cursors in Stored Procedures
Configure Oracle Reference Cursors in Stored Procedures
No configuration is needed to leverage Oracle reference cursors in stored procedures.
OpenLink's drivers use the same syntax recognized by Oracle native and 3rd-party drivers.
Default Driver Capability
Default Driver Capability
This feature is a driver default and requires no additional configuration.
Configure Oracle Unicode Support
Configure Oracle Unicode Support
The Oracle configuration parameter for control character sets is the NLS_LANG environment variable, which should be set to the correct character set for your client. Oracle 8.1.7 claims to be capable of dynamically determining the character set in use on the client and does not require the NLS_LANG to be set, but it is not a bad idea to set it anyway.
Additional information on Oracle Unicode support can be found from otn.oracle.com