This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes JDBC and JApplet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "JDBC and JApplet" Watch "JDBC and JApplet" New topic
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: 265
I think u didnt set the classpath .try to set the classpath and extract the classes12.zip in ur lib directory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC and JApplet