Forums Register Login

JDBC connectivity problem

+Pie Number of slices to send: Send
I dont have the client application Oracle in my sys.
If i use oracle thin jdbc it is not necessary to have oracle in the ys.
i downloaded the driver ojdbc14.jar from the site
i donno whether i have to include anything in the class path
and my code is
import java.sql.*;
import java.io.*;
import java.util.*;
public class OraTest
{

public static void main(String args[])
{
try{
String User="scott";
String Passwd="tiger";
String OraConStr = "jdbc racle:thin:scott/tiger@(description=(address_list=(address=(protocol=tcp)(host=192.168.4.45)(port=1521)))(connect_data=(SERVICE_NAME = test)))";
StringBuffer stbTmp = new StringBuffer();
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection OraCon=DriverManager.getConnection(OraConStr,User,Passwd);
System.out.println("Connected to Oracle");
}
catch(Exception ex)
{
System.out.println(ex);
}
}
}
If i run this iam getting some run time exception
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
wat is the problem?
+Pie Number of slices to send: Send
 

Originally posted by kiruthika raghunathan:

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
wat is the problem?


Make sure 192.168.4.45 is the right IP address for the Oracle server, that you can ping that IP, that the port you have specified is the correct one for the Oracle DB, and that the service name you have specified exists.
+Pie Number of slices to send: Send
thanx a lot for ur reply
ur right the ip address is wrong in the code
+Pie Number of slices to send: Send
Good to hear that you have solve the problem. The error message can also means your services did not started properly. Either the TNSagent or the database services.
EQ
Could you hold this kitten for a sec? I need to adjust this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 922 times.
Similar Threads
Urgent....
cannot connect to oracle using datadirect JDBC driver
JNDI Lookup help in websphere 4.0
Error in creating Instance
Writing CLOB
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:29:55.