| Author |
JDBC and JApplet
|
Jasbir Dhaliwal
Greenhorn
Joined: Mar 04, 2003
Posts: 12
|
|
Hi, I did the whole connection with JDBC to oracle in application.It worked fine.But the moment i converted it to applet i had this error message : java.lang.ClassNotFoundException racle.jdbc.driver.OracleDriver The code in applet is: import java.sql.*; import javax.swing.*; public class ttt extends JApplet{ public void init(){ try{ Class.forName("oracle.jdbc.driver.OracleDriver"); String sourceURL ="jdbc racle:thin:@myserver:1521:mysid"; String user="combtest"; String password="combtest"; Connection databaseConnection=DriverManager.getConnection(sourceURL,user,password); JOptionPane.showMessageDialog(null,"Connection established"); databaseConnection.close(); } catch(ClassNotFoundException cnfe){ JOptionPane.showMessageDialog(null,cnfe); } catch(SQLException sqle){ JOptionPane.showMessageDialog(null,sqle); } } } And the code in application that works well is: //package coreservlets; import java.sql.*; class tt { public static void main(String [] args){ try{ Class.forName("oracle.jdbc.driver.OracleDriver"); String sourceURL ="jdbc racle:thin:@myserver:1521:mysid "; String user="combtest"; String password="combtest"; Connection databaseConnection=DriverManager.getConnection(sourceURL,user,password); System.out.println("Connection established successfull!"); databaseConnection.close(); } catch(ClassNotFoundException cnfe){ System.err.println(cnfe); } catch(SQLException sqle){ System.err.println(sqle); } } } could anyone pls help me ? Jasbir
|
 |
Graham Thorpe
Ranch Hand
Joined: Mar 25, 2002
Posts: 264
|
|
|
I think u didnt set the classpath .try to set the classpath and extract the classes12.zip in ur lib directory.
|
 |
 |
|
|
subject: JDBC and JApplet
|
|
|