views:

125

answers:

2

Hello,

I would like to connect to a clustered Oracle database described by this TNS:

 MYDB=
 (DESCRIPTION = 
    (ADDRESS = (PROTOCOL = TCP)(HOST = host1)(PORT = 41521)) 
    (ADDRESS = (PROTOCOL = TCP)(HOST = host2)(PORT = 41521)) 
    (LOAD_BALANCE = yes) 
    (CONNECT_DATA = 
     (SERVER = DEDICATED) 
     (SERVICE_NAME= PDSALPO)
    )
 )

I connect normally from my application to non-clustered Oracle using the following configuration:

<group name="jdbc">
 <prop name="url">jdbc:oracle:thin:@host1:41521:PDSALPO</prop>
 <prop name="username">user</prop>
 <prop name="password">pass</prop> 
</group>

Do you know how I can change that to connect to the clustered database?

Thanks,

Tam

+2  A: 

Apparently you can do this

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)))
Matthew Watson
A: 

You can use this format, unless you make use of JTA transactions. In that case you must use some different setup. See http://forums.oracle.com/forums/thread.jspa?messageID=2860653&amp;#2860653 (applies for BEA Weblogic, but I think it also applies for other setups and application servers)