wood burning stoves 2.0*
The moose likes JDBC and the fly likes jdbc in Unix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc in Unix" Watch "jdbc in Unix" New topic
Author

jdbc in Unix

Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
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
Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
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
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
 
jQuery in Action, 2nd edition
 
subject: jdbc in Unix
 
Similar Threads
PreparedStatement.toString()
JDBC- ORACLE
Installation of JDriver (weblogic 5.1) for Oracle on Solaris
Oracle OCI Driver
JDBC- ORACLE