Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC and JApplet

 
Jasbir Dhaliwal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think u didnt set the classpath .try to set the classpath and extract the classes12.zip in ur lib directory.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic