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

From: Yong Huang <yong321_at_yahoo.com>
Date: Wed, 5 Dec 2012 07:23:49 -0800 (PST)
Message-ID: <1354721029.59066.YahooMailClassic_at_web184806.mail.gq1.yahoo.com>



> 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:_at_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:_at_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

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Dec 05 2012 - 16:23:49 CET

Original text of this message