• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

JDBC Error - The Network Adapter could not establish the connection

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
chandubcs
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry guys, I was using the port number as 1526, where I need to use 1521... Thanks much
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's much better than my answer.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic