• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jdbc in Unix

 
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

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
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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. )
 
Simon Xu
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic