X

Proactive insights, news and tips from Oracle WebLogic Server Support. Learn Oracle from Oracle.

Oracle Driver Types in the WebLogic Console

Stephen Felts
Manager

In the early days, there was only a single URL format supported for the Oracle thin driver and it could be used with either the XA or non-XA driver class for a GENERIC datasource.  Over the years, more URL formats and driver classes have been supported so now there are nine options listed in the dropdown box for the Oracle driver when creating a datasource in the console (note that the DataDirect Driver is no longer shipped with the product).

 

The following is a description of the nine supported options based on the console input, a sample of the URL that is generated from the input, and the driver that is configured.

1. Database Driver Type in Console: Oracle’s Driver (Thin XA) for Application Continuity; Versions: Any
URL Input: Database is used as service name (the “Database” header is really a misnomer), host, port
Sample Generated URL: jdbc:oracle:thin:@//host:1521/service
Driver:  oracle.jdbc.replay.OracleXADataSourceImpl   (XA replay driver)

2. Database Driver Type in Console: Oracle’s Driver (Thin XA) for Instance connections; Versions: Any
URL Input: Database is used as SID, host, port.  The use of SID is deprecated.  You should stop using this format and instead use the service name.
Sample Generated URL: jdbc:oracle:thin:@host:1521:SID
Driver: oracle.jdbc.xa.client.OracleXADataSource

3. Database Driver Type in Console: Oracle’s Driver (Thin XA) for Service-Instance connections; Versions: Any
URL Input: Database is used as instance name (the header “Database” is really a misnomer), service name, host, port.  This format is used when the service is available on multiple instances and the URL should map to a single instance for GENERIC and Multi Datasource.  A long format URL is generated so that the instance name can be specified.
Sample Generated URL: jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))
    (CONNECT_DATA=(SERVICE_NAME=service)(INSTANCE_NAME=instance)))
Driver:   oracle.jdbc.xa.client.OracleXADataSource

4. Database Driver Type in Console: Oracle’s Driver (Thin XA) for Service connections; Versions: Any
URL Input: Database is used as service, host, port.  Note that a slash precedes the service name (a colon precedes the SID).
Sample Generated URL: jdbc:oracle:thin:@host:1521/service
Driver:  oracle.jdbc.xa.client.OracleXADataSource

5. Database Driver Type in Console: Oracle’s Driver (Thin) for Application Continuity; Versions: Any
URL Input: Database is used as service, host, port
Sample Generated URL:  jdbc:oracle:thin:@//host:1521/service
Driver:  oracle.jdbc.replay.OracleDataSourceImpl

6. Database Driver Type in Console: Oracle’s Driver (Thin) for Instance connections; Versions: Any
URL Input: Database is used as SID, host, port.  The use of SID is deprecated.  You should stop using this format and instead use the service name.
Sample Generated URL:  jdbc:oracle:thin:@host:1521:SID      
Driver:  oracle.jdbc.OracleDriver

7. Database Driver Type in Console: Oracle’s Driver (Thin) for Service connections; Versions: Any
URL Input: Database is used as service, host, port.  This is the default and most popular format for GENERIC datasources.  The service should be available on a single instance for GENERIC and Multi Datasource.
Sample Generated URL:  jdbc:oracle:thin:@host:1521/service 
Driver:  oracle.jdbc.OracleDriver

8. Database Driver Type in Console: Oracle’s Driver (Thin) for Service-Instance connections; Versions: Any
URL Input: Database is used as instance, service, host, port
Sample Generated URL:  jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))
    (CONNECT_DATA=(SERVICE_NAME=service)(INSTANCE_NAME=instance)))
Driver:  oracle.jdbc.OracleDriver

9. Database Driver Type in Console: Oracle’s Driver (Thin) for pooled instance connections; Versions: Any
URL Input: Database is used as SID, host, port.  This format is used to get a pooled datasource and is not commonly used.
Sample Generated URL:  jdbc:oracle:thin:@host:1521:SID      
Driver:  oracle.jdbc.pool.OracleDataSource

The creation form to input the URL information looks like the following.

There are lots of variations on the URL.  Further, there are some newer formats that are not automatically generated by the console.  For those formats, just pick any of the supported formats and enter throw-away values.  The URL can be manually updated on a subsequent form before testing the datasource.

Two of the more popular formats are the long format and the alias format.

The long format can be used to specify options like retry delay and count, as in the following sample.

jdbc:oracle:thin:@ (DESCRIPTION=(CONNECT_TIMEOUT=120)(RETRY_COUNT=20)(RETRY_DELAY=3)(TRANSPORT_CONNECT_TIMEOUT=3)
   (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=service)))

The alias format can be used to reference an alias in the tnsnames.ora file, as in the following sample.  The oracle.net.tns_admin driver property must be used to specify the directory location for this file.
jdbc:oracle:thin:@alias

The long format is generally recommended because it uses the service name instead of the SID and provides access to new features in later versions of the driver.  The long format can optionally be stored in the tnsnames.ora file by using the alias format in the datasource definition.

 

 

 

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.