Results 1 to 2 of 2

Thread: Java applet connection error [MySQL DB]

  1. #1
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java applet connection error [MySQL DB]

    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

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Why do you have one-time variables, why are you using AWT rather than Swing, and what exactly is the error?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •