Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ways of connecting to Oracle..

Status
Not open for further replies.

kanghao

IS-IT--Management
Jul 4, 2004
68
KR
What's the difference between two cases below.

case 1)
String url = "jdbc:eek:racle:thin:mad:(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.133.103.142)(PORT=1522))(ADDRESS=(PROTOCOL=TCP)(HOST=10.133.103.112)(PORT=1522)))(CONNECT_DATA = (SERVICE_NAME = ORAKIPO))))"
String driver = "oracle.jdbc.driver.OracleDriver"
Class.forName(driver);
con = DriverManager.getConnection(url, "user", "password");

case 2)
String url = "jdbc:eek:racle:thin:mad:kpodb2.kipo.go.kr:1521:ORAKIPO"
String driver = "oracle.jdbc.driver.OracleDriver"
Class.forName(driver);
con = DriverManager.getConnection(url, "user", "password");
 
In your first example you are trying to utilize load balancing, in the second you are going only to one distinct server.
 
>>>> In your first example you are trying to utilize load balancing


How do you guess that ?


--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
sedj

Perhaps I jumped to a conclusion too soon. Is there another use for multiple addresses in the connect string that you know of? At my shop we utilize load balancing and our connect strings look very similiar to our friend kanghao's.

An example of a connect string I might use:

Code:
jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)
(HOST=host1.someplace.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=host2.someplace.com)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=myServiceName)))

Rich
 
DaWickedRebel :

I'm not familiar with providing oracle TNS drivers with multiple hosts, and it may be well a loadbalancing solution that the the original poster was asking about ...

If you provide the driver with two hosts, how does it work out which one it should use ?

Anyhow, unfortunately, after 3 years of duty here, I become sceptical of posters posting incorrect or incomplete data. Considering a very similar issue was brought up by this poster in July, I wondered what had changed ...

kanghao : any input from you at all ?


--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
under some circumstances only case1 works
under some circumstances only case2 works.
why?
case2 is supposed to work all the time?

 
Well, what are the circumstances in which case 1 works, and what are they when case 2 works?

Tim
---------------------------
"Your morbid fear of losing,
destroys the lives you're using." - Ozzy
 
Doesn't work" ... what does that means - you will need to provide specific details, errors, stack traces, behaviour patterns etc in order for use to help.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top