I am trying to access an Oracle DB sitting on a different LAN through my Java application by using JDBC,and I have the driver(classes12.zip).When I user the url ("jdbc racle:thin:@//18.104.22.168:1521/myoracle","user", "password" ) to get the Connection,I get a SQLException(Io Exception: The Network Adapter could not establish the connection).Why I get the SQLException?
I try to get the connection from my computer to the oracle sever in the other LAN. I have Try DriverManager.registerDriver( new oracle.jdbc.driver.OracleDriver()); Connection connection = DriverManager.getConnection("jdbc racle:thin:@202.201.57:1521:myoracle","USER","PASSWORD"); but I get SQLException again(IOException Network Adapter can't establish connection).Maybe the user can not have the privilege to visit the server remotely?
Are you sure you can get to the IP address? Ping 22.214.171.124 and be sure you can get to it without java "in the way" so to speak. Also verify that port 1521 is the correct port. You can always use Oracle's regular tools to see i you can get a connection first, and then work from there (assuming you have them installed).
Originally posted by Michael Cassidy: Try DriverManager.registerDriver( new oracle.jdbc.driver.OracleDriver()); Connection connection = DriverManager.getConnection("jdbc racle:thin:@202.201.57:1521:myoracle","USER","PASSWORD");
without smilies, it is DriverManager.getConnection("jdbcracle:thin:@202.201.57:1521:myoracle","USER","PASSWORD"); Also, make sure the database is up and running on the server ( aka, can connect using SQL plus or some other tool)
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Thanks! bear Forum Bartender
Joined: Aug 18, 2003
Thank you for your reply.
I am using Oracle 10g application server. configured my database using data-source.xml file. I am looking for datasource using JNDI lookup. I guess Oracle 10g application should have all drivers within it and use respective driver. Even if there is a database upgrade it should take care of it. I was assuming this because, in the application server configuration, I will not configure which driver it should use but just provide a URL and JNDI name.
I would appreciate if you could clarify me on this.
i'm also getting the same error when i try to configure weblogic connection pool. I use Oracle 10g. have the classes12.jar and the 10g ojdbc14.jar set in the CLASSPATH before weblogic.jar as specified in the documentation, but still get the error. i can connect thru' sqlplus.
the main problem for this error is the listner is not installed in your system or its not started
go to control pannel->administratiove tool->services->oracle listner (some four files strting with oracle see all the four files are in started) if its not started(rightclick and start) try to start it and run the programe it will work if the listener is not started try it by restarting the stystem it will defenetly work
I would suggest the following may be causing this kind of error:
1. (obvious) IP address is incorrect - try PING <ip>
2. The port is not open, or is blocked by a firewall - try TELNET <ip> <port>
3. The DB listener is not running or is binding to a different network interface - again, TELNET should confirm this (also use Oracle client tools to connect)
4. No local ports are available for the out-going connection (unlikely) - only if you're making thousands of connections, or creating hundreds of new connections every minute.
Hi Jason ,
It would very kind if you can help me out of this ,we are getting this error while running a batch file from our windows 2003 Application server
Message :Fatal Error in Publish Daemon SQL connection get returned error. Message:Io exception: The Network Adapter could not establish the connection SQLState :[null] ErrorCode : 
Stack Tracejava.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at com.xyz.abc.util.ConnectionManager.getConnectionForBatch(Unknown Source)
at com.xyz.abc.common.custom.BatchCustom.getConnnectionToHost(Unknown Source)
at com.xyz.abc.batch.alertserver.PublishDaemon.getCurrentDate(Unknown Source)
at com.xyz.abc.batch.alertserver.PublishDaemon.main(Unknown Source)
I had the same problem when trying to connect my oracle database using oracle sql developer, giving the error "the network adapter could not establish the connection". The only thing I did to resolve the error is starting the listener; just start