• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

JDBC and JApplet

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic