When using JDBC I like the new DataSource-way
to establish the connection. Further I like the isolated set-Methods for the properties like setUser
, setPassword
, setDriverType
, setServerName
, setNetworkProtocol
, setDatabaseName
, setPortNumber
and so on.
The question is (esp. for the use with Oracle), if there is a way to set up LoadBalancing with two or more servers without specifying the URL directly with
setURL("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=dbsrv1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=dbsrv2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=dbpool)))");
for example.
Best Answer
Thin client can also use alias defined in tnsnames.ora. In java call set -Doracle.net.tns_admin=...
http://docs.oracle.com/cd/B19306_01/java.102/b14355/urls.htm