JDBC Error - The Network Adapter could not establish the connection

Posted on 2003-10-22
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 machine within the network.

The code is:

  DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
  Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@","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(
        at oracle.jdbc.dbaccess.DBError.throwSqlException(
        at oracle.jdbc.dbaccess.DBError.throwSqlException(
        at oracle.jdbc.driver.OracleConnection.<init>(
        at oracle.jdbc.driver.OracleDriver.getConnectionInstance(
        at oracle.jdbc.driver.OracleDriver.connect(
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at DBConn.getConn(
        at DBConn.main(

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?

Question by:chandubcs

Accepted Solution

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

Author Comment

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

Expert Comment

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.


EE Cleanup Volunteer

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 85
java. non-English characters encoding problem. intellij idea 3 74
Running Jira on Raspberry PI 2? 3 255
stackato and cloud 4 68
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now