Oracle: thin driver connection url string with RAC 

Joined:
04/09/2007
Posts:
710

February 09, 2010 04:54:10    Last update: February 09, 2010 04:54:10
Use this to connect to oracle RAC (Real Application Cluster):
jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
                  (ADDRESS=(PROTOCOL=TCP)(HOST=host1) (PORT=1521))
                  (ADDRESS=(PROTOCOL=TCP)(HOST=host2) (PORT=1521))
                  (CONNECT_DATA=(SERVICE_NAME=service)
		      (FAILOVER_MODE = (TYPE = SELECT)
                                       (METHOD = BASIC)
                                       (RETRIES = 180)
                                       (DELAY = 5))
                  ))


From Oracle Database JDBC Developer's Guide:
SpecifierSupported DriversExample
Oracle Net connection descriptorThin, OCI
Thin, using an address list:

url="jdbc:oracle:thin:@(DESCRIPTION=
(LOAD_BALANCE=on)
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=host1) (PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=host2)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=service_name)))"


OCI, using a cluster:

"jdbc:oracle:oci:@(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=cluster_alias)
(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=service_name)))"

Thin-style service nameThin
"jdbc:oracle:thin:scott/tiger@//myhost:1521/myservicename"
LDAP syntaxThin
"jdbc:oracle:thin:@ldap://ldap.example.com:7777/sales,cn=OracleContext,dc=com"
Bequeath connectionOCIEmpty. That is, nothing after @

"jdbc:oracle:oci:scott/tiger/@"
TNSNames aliasThin, OCIOracleDataSource ods = new OracleDataSource();
ods.setTNSEntryName("MyTNSAlias");


Share |
| Comment  | Tags
 
Easy email testing with http://www.ximailstop.com