Solved

JDBC Error - The Network Adapter could not establish the connection

Posted on 2003-10-22
4
554 Views
Last Modified: 2007-12-19

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:oracle:thin:@111.111.11.11:1526:DBinstance","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?

Thanks,
cs
0
Comment
Question by:chandubcs
4 Comments
 
LVL 3

Accepted Solution

by:
savalou earned 125 total points
ID: 9599547
Isn't the default oracle port 1521?  Did you change it on purpose?
0
 

Author Comment

by:chandubcs
ID: 9599611
Yeah... I am sorry, I was using the port number as 1526, I need to use 1521... Thanks much
0
 
LVL 92

Expert Comment

by:objects
ID: 10194163
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept savalou's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

objects
EE Cleanup Volunteer
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet doXXX methods 3 61
hibernate example issues from command prompt 10 50
jboss 7.1 start up error 1 28
Java: anonymous class 4 29
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question