Results 1 to 4 of 4

Thread: Java + Mysql

  1. #1
    Join Date
    Nov 2004
    Location
    St.Peterburg, Russia
    Posts
    2

    Unhappy Unanswered: Java + Mysql

    Hi, i don't speak english well, so please appologise me for my mistakes.

    I use Windows XP. NetBeans IDE 3.6. JDK 1.5.

    I'm a newbie in Java. And i'm writing an applet, that will shows the statistics from a mysql database. I've downloaded a JDBC Mysql driver from mysql.org and registering it as show in documentation:

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;

    public class TrafficViewer extends javax.swing.JApplet {

    public TrafficViewer() {
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance ();
    }
    catch (Exception ex)
    {
    System.out.println("No driver");
    }

    try {
    Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1/test?user=test");
    }
    catch (SQLException ex)
    {
    System.out.println("SQLException: " + ex.getMessage());
    System.out.println("SQLState: " + ex.getSQLState());
    System.out.println("VendorError: " + ex.getErrorCode());
    }

    }

    }

    During compilation there are no errors, but when i try to run it in AppletViewer, i got:

    No driver
    SQLException: No suitable driver
    SQLState: 08001
    VendorError: 0

    I've checked CLASSPATH. everything is ok. There are no docs about errors that can occur during connection to mysql.

    Please if there are any ideas how to find a mistake.... tell me.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

  3. #3
    Join Date
    Nov 2004
    Location
    St.Peterburg, Russia
    Posts
    2
    So u mean that i can't load driver couse of security reasons?

    But i have seen many applets on the sites that (i'm sure) use use db connection. So how can i realise it?

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by damned
    So u mean that i can't load driver couse of security reasons?
    I think this might be the reason, yes.

    Another place to look would be to ensure that the communication with the database can be established. Did you try to connect to your database using a stand-alone application? What does "telnet 127.0.0.1:3306" tell you?

Posting Permissions

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