Oracle: thin driver connection url string with RAC
February 09, 2010 04:54:10 Last update: February 09, 2010 04:54:10
Use this to connect to oracle RAC (Real Application Cluster):
From Oracle Database JDBC Developer's Guide:
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:
| Specifier | Supported Drivers | Example |
|---|---|---|
| Oracle Net connection descriptor | Thin, OCI |
Thin, using an address list: url="jdbc:oracle:thin:@(DESCRIPTION=
OCI, using a cluster: "jdbc:oracle:oci:@(DESCRIPTION=
|
| Thin-style service name | Thin |
"jdbc:oracle:thin:scott/tiger@//myhost:1521/myservicename" |
| LDAP syntax | Thin |
"jdbc:oracle:thin:@ldap://ldap.example.com:7777/sales,cn=OracleContext,dc=com" |
| Bequeath connection | OCI | Empty. That is, nothing after @
"jdbc:oracle:oci:scott/tiger/@" |
| TNSNames alias | Thin, OCI | OracleDataSource ods = new OracleDataSource();
|
Easy email testing with http://www.ximailstop.com