aspose file tools*
The moose likes JDBC and the fly likes JDBC Error - The Network Adapter could not establish the connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Error - The Network Adapter could not establish the connection" Watch "JDBC Error - The Network Adapter could not establish the connection" New topic
Author

JDBC Error - The Network Adapter could not establish the connection

chandubcs
Ranch Hand

Joined: Jun 03, 2001
Posts: 47
Hi all,
I appreciate if anyone could help me out with my issue. I wrote simple java code on win 2000 to test whether I will be able to access Oracle 8i DB resided at some xxx.xxx.xxx.xxx machine within the network.
The code is:
---------------------------------------
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc racle:thin:@111.111.11.11:1526 Binstance","user","password");
---------------------------------------
The fist line here is executing and the problem is with second line of code. After executing this application from my DOS window, I am getting error:
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:324)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:266)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at DBConn.getConn(DBConn.java:15)
at DBConn.main(DBConn.java:40)
I have installed Oracle client, where I can access the same database using SQL * Plus, but why I am unable to access the database from a Java Application? Do I need any web/application server to access it?
Any Suggestions please?
Thanks,
cs
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8964
    
    9

It sounds like you are not connected to the network, but if you can log into the database with SQL Plus, I'd rule that out. Is 111.111.11.11 (or whatever you have as an IP in the URL) the IP address of the database server?
Oh, and there's a checkbox at the bottom of the Post screen that lets you turn smilies off. Necessary for JDBC URLs.
[ October 22, 2003: Message edited by: Joe Ess ]

[How To Ask Questions On JavaRanch]
chandubcs
Ranch Hand

Joined: Jun 03, 2001
Posts: 47
I am sorry guys, I was using the port number as 1526, where I need to use 1521... Thanks much
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8964
    
    9

That's much better than my answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC Error - The Network Adapter could not establish the connection