This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I run a simple program on Solaris. It gave the following error: Error Connecttion java.sql.SQLException: Io exception: The Network Adapter could not establish the connection at java.lang.Throwable.fillInStackTrace(Native Method) at java.lang.Throwable.fillInStackTrace(Compiled Code) at java.lang.Throwable.<init>(Compiled Code) at java.lang.Exception.<init>(Exception.java:42) at java.sql.SQLException.<init>(SQLException.java:43) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269) at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:210) at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja va:251) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224) at java.sql.DriverManager.getConnection(Compiled Code) at java.sql.DriverManager.getConnection(DriverManager.java:137) at JdbcTest.doTest(Compiled Code) at JdbcTest.main(JdbcTest.java:42) The URL and driver are correct, What is the problem? Thanks
Monty Ireland
Ranch Hand
Joined: Oct 03, 2000
Posts: 161
posted
0
I got a simular error on NT a few months ago. Question: 1. Do you have the oracle jdbc driver in you classpath? 2. Has Net8 been stup correctly. 3. Is your URL refering to the thin client or OCL driver. Request: 1. copy of path 2. copy of classpaht 3. copy of Class.forNames 4. copy of your URL TTFN, Monty
------------------ Multi-Platform Database Developer ( on E.S.T. )
Multi Platform Database Developer & DBA on E.S.T.
Simon Xu
Ranch Hand
Joined: Aug 16, 2000
Posts: 235
posted
0
hi, Monty, Thanks for your reply. It is not classpath or drive problem, as another program runs OK. Here is the code: <code> import java.sql.*; public class JdbcTest1 { public void doTest(){ try{ Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con =DriverManager.getConnection( "jdbc racle:thin:@geodel.newcs.uwindsor.ca:1521:CS01", "simon", "p548") ; Statement stmt = con.createStatement(); System.out.println("Table Created?"+ stmt.executeUpdate( "create table mytable (sno integer, name varchar(20) )")); System.out.println("Inserted?"+ stmt.executeUpdate("insert into mytable values (1, 'Silly')")); System.out.println("Inserted?"+stmt.executeUpdate ("insert into mytable values (2, 'Ken')")); ResultSet rs = stmt.executeQuery("select * from mytable"); while ( rs.next() ){ System.out.println("SNO==>" + rs.getInt("sno")+"\n"); System.out.println("SNO ==>"+ rs.getString("name")+"\n"); } }catch (Exception e){ System.out.println("Error Creating Record"); e.printStackTrace(); } } public static void main( String[] args ) { JdbcTest1 test = new JdbcTest1(); test.doTest(); } } </code> Thanks Thanks