Re: Connecting to a RAC instance using JDBC:thin driver

  • From: Yong Huang <yong321@xxxxxxxxx>
  • To: sjwales@xxxxxxxxxxx
  • Date: Wed, 5 Dec 2012 07:23:49 -0800 (PST)

> Is there a way to pass through a connect string to a RAC database, via 
> the jdbc thin client without using parentheses in the connect string.

Why not use the TNSNames method? Define the complicated connection string in 
your tnsnames.ora, and use the alias (connect identifier) in your JDBC URL:

String url = "jdbc:oracle:thin:@tns_entry";

Make sure to define -Doracle.net.tns_admin=$ORACLE_HOME/network/admin.

I can even use that method from command line:

C:\temp>C:\oracle\product\11.2.0\client\jdk\bin\java 
-Doracle.net.tns_admin=C:\oracle\product\11.2.0\client\network\admin -cp
 .;C:\oracle\product\11.2.0\client\jdbc\lib\ojdbc5.jar JDBCDemo 
jdbc:oracle:thin:@dba011 yong xxxx "select * from dual"
Connection Successful!
SQL: select * from dual

Ref: http://docs.oracle.com/cd/E11882_01/java.112/e10589/urls.htm#BEIDIJCE
--
//www.freelists.org/webpage/oracle-l


Other related posts: