Just want to connect to oracle8i
I'm trying to connect to my oracle8i db, but it just cant succeed. I'm using the thin driver and I have registered classes12.zip in the classpath(Classpath = C:\oracle8i\jdbc\lib\classes12.zip)
It failes in the ClassNotFoundException which means that it Failed to load JDBC driver.
What have I forgot to do(my db is running normal, and I'm able to log to sqlplus and excecute queris, create tables and so on.)
import java.sql.*;
publicclass KobleTilDbThin{
private Connection con;
public KobleTilDbThin(){
String username ="scott";
String password ="tiger";
createConnection(username,password);
}
public KobleTilDbThin( String user,String pass){
createConnection(user,pass);
}
privatevoid createConnection(String user,String pass){
try{
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@lt-ivan.xientia.local"
+":1521:orcl", user,pass);
}
catch ( ClassNotFoundException cnfex){
System.out.println("Failed to load JDBC driver.");
System.exit(1);
}
catch ( SQLException sqlex){
System.out.println("ConnectToDBThin: Unable to connect.");
System.exit(1);
}
}
publicvoid closeConnection(){
try{
con.close();
}
catch ( SQLException sqlex ){
System.out.println("Unable to disconnect.");
}
}
public Connection getConnection(){
return con;
}
publicstaticvoid main(String[] args)
{
KobleTilDbThin db =new KobleTilDbThin();
db.closeConnection();
}
}

