hi, about a week ago i posted a
thread (
https://coderanch.com/t/297853/JDBC/java/mysql-jdbc-connection) cuz i was having problems making a connection to a msyql database and kept getting the:
exeption in thread "main" java.lang.ClassNotFoundException rg.gjt.mm.mysql.Driver
error. i resolved this (with the help i got in the thread).
i went on to try and create an
applet that will be able to access the same database and encountered the same issue:
java.lang.ClassNotFoundException
rg.gjt.mm.mysql.Driver
im wondering if there is something im missing here, that i must change for the applett to function. i set classpath variable in a dos prompt (im running windows2000) and compile the applet and no problems. i go to run in browser and get the exception.
HERE IS CODE:
import java.sql.*;
public class testApplet extends javax.swing.JApplet {
String url = "jdbc:mysql://localhost/people";
String user = "odbc@localhost";
String password = "*******";
public testApplet() {
initComponents();
}
private void initComponents() {
jButton1 = new javax.swing.JButton();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
getContentPane().setLayout(new java.awt.FlowLayout());
setName("");
jButton1.setText("search");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jTextField1.setPreferredSize(new java.awt.Dimension(250, 21));
getContentPane().add(jTextField1);
jTextField2.setPreferredSize(new java.awt.Dimension(80, 21));
getContentPane().add(jTextField2);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
Class.forName("org.gjt.mm.mysql.Driver");
Connection c= DriverManager.getConnection(url,user,password);
Statement s = c.createStatement();
}catch(Exception e){
jTextField1.setText(e.toString());
}
}
private javax.swing.JButton jButton1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
}
any help would be much appreciated. thanks in advance.