PDA

View Full Version : Java applet connection error [MySQL DB]



kprojects
08-26-2008, 02:44 PM
Hello,

I'm stuck with the same problem the last few days. I'm creating an applet in which you have to log in before you are able to see your account details. I tried this in an application and it worked fine. I dont see the difference, can some of you guys help me ? Here is the code i used:

I'm doing all of this at my localhost server, port 3306 (as far is i know its default), and my users_db database

static String DBURL = "jdbc:mysql://localhost:3306/users_db?user=****&password=********";
try {

try {
try {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (InstantiationException ex) {

} catch (IllegalAccessException ex) {

}
} catch (Exception ex) {

}
}
catch (Exception ex) {

}



Connection con = DriverManager.getConnection(DBURL);
System.out.println("Succesfully connected!");
Label ok = new Label("Connected");
add(ok);
}
catch(SQLException e) {
Label not = new Label("Not connected:"+e.getMessage());
add(not);
}

Greetz,

Kprojects

Twey
08-26-2008, 05:52 PM
Why do you have one-time variables, why are you using AWT rather than Swing, and what exactly is the error?