Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Posts
    5

    Exclamation Unanswered: Java.SQL.Exception IoThe Network Adapter could not establish the connection

    Hi...I am a new programmer, while connecting to Oracle9i (Release 9.2.0.1.0) database thru JDBC I am getting the following Error:

    "Java.SQL.Exception IoThe Network Adapter could not establish the connection "

    I am using windows XP professional edition and using j2sdk1.4.0 for compiling my Java code.

    Below is my Java code. Code compiles fine, but get the error at run time. I will really appreciate any help to make this work.


    import java.sql.*;
    import java.math.*;

    public class DB1 {

    public static void main(String[] args)
    {
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection("jdbcracle:thin:@D21FF13:1521:EMP2","scott","tiger");

    Statement st = conn.createStatement();
    ResultSet rec = st.executeQuery("SELECT LOC " + "FROM EMP2.DEPT");

    while(rec.next())
    { System.out.println(rec.getString("LOC"));

    }
    st.close();
    }catch(Exception e)
    {
    System.out.println("Error - " + e.toString());
    }
    }
    }



    This is my classpath:
    .;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8bin;C:\WINDOWS\system32;C:\W INDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\ULTRAE ~1;C:\j2sdk1.4.\bin;C:\oracle\ora92\bin;C:\oracle\ ora92\jdbc\lib\classes111.zip;C:\oracle\ora92\jdbc \lib\nls_charset11.zip;C:\oracle\ora92\jdbc\lib\oj dbc14.jar;C:\oracle\ora92\jdbc\lib\nls_charset12.z ip

  2. #2
    Join Date
    Aug 2003
    Location
    Singapore
    Posts
    5
    I have similar problem. did you manage to ger any resolution

  3. #3
    Join Date
    Apr 2003
    Posts
    5
    I had to add the following in my classpath and path. Adding the lines below resolved the problem. The classpath below is for Oracle9i. If you are using anyother version of oracle, probably you might want to check the documentation for the jar and zip files that needs to be added in the classpath.

    CLASSPATH = ADDED THE FOUR LINES BELOW

    C:\oracle\ora92\jdbc\lib\classes111.zip

    C:\oracle\ora92\jdbc\lib\nls_charset11.zip

    C:\oracle\ora92\jdbc\lib\ojdbc14.jar

    C:\oracle\ora92\jdbc\lib\nls_charset12.zip

    c:\jdk1.4\bin;----> you might want to change on the version of the JDK you are using.


    ________________________________

    Path = ADDED the two lines below:

    PATH =

    c:\oracle\ora92\bin;

    c:\jdk1.4\bin;----> you might want to change on the version of the JDK you are using.


    Hope this will help....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •