Link to home
Start Free TrialLog in
Avatar of rospcc
rospcc

asked on

JDBC Oracle connection in java

I have connection to Oracle database in ASP. Now, I have problem converting to the connection to use JDBC in java. Please help shed some light.

Oracle Connection in ASP
------------------------------
strConn ="DRIVER={Oracle in OraHome90};DSN=<DSN>;DBQ=<DBQ>;UID=<user name>;PWD=<password>;"
Set conntemp = Server.CreateObject("ADODB.Connection")
if conntemp.state=0 then
      conntemp.Open strConn

My attempt in JDBC
---------------------
String driver = "oracle.jdbc.driver.OracleDriver";
Class.forName(driver);

DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@(description=(address=(host=<host name>)(protocol=tcp)(port=<port>))(connect_data=(sid=<sid>)))",<user name>,<password>);

When i run the connection in java, i get IOException : The network adapter could not establish the connection.

Is it because i specify the host name wrongly?

thanks
                  
ASKER CERTIFIED SOLUTION
Avatar of mnrz
mnrz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also you need in CLASSPATH variable the Oracle classes for connection to the database.