Results 1 to 6 of 6
  1. #1
    ahmadn is offline Member
    Join Date
    Jun 2011
    Posts
    3
    Rep Power
    0

    Default error with connection Mysql

    Hi,

    I use the Mysql database

    and when I run the program , out to me these errors


    Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:285)
    at java.sql.DriverManager.getConnection(DriverManager .java:582)
    at java.sql.DriverManager.getConnection(DriverManager .java:185)
    at NewClass.main(NewClass.java:21)
    Caused by: java.lang.RuntimeException: Uncompilable source code - com.mysql.jdbc.Connection is not abstract and does not override abstract method createStruct(java.lang.String,java.lang.Object[]) in java.sql.Connection
    at com.mysql.jdbc.Connection.<clinit>(Connection.java :87)
    ... 4 more
    Java Result: 1

    please can some one help me ????

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    Can you show us your code, as well as tell us what JDBC driver you are using and version?

  3. #3
    ahmadn is offline Member
    Join Date
    Jun 2011
    Posts
    3
    Rep Power
    0

    Default

    i use JDBC 5.0.8
    and thats the cod

    try
    {

    Class.forName("com.mysql.jdbc.Driver");

    String url = "jdbc:MySQL://localhost:3306/mysql";

    Connection con = DriverManager.getConnection( url,"root", "");

    System.out.println("URL: " + url);
    System.out.println("Connection: " + con);


    con.close();
    }catch( Exception e )
    { e.printStackTrace();

    }

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    What is the driver though?
    What MySQL JDBC jar are you using?

  5. #5
    ahmadn is offline Member
    Join Date
    Jun 2011
    Posts
    3
    Rep Power
    0

    Default

    mysql connector java 5.0.8

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    You either need to use an older JRE or a newer connector.
    The createStruct() method was added in Java 1.6.
    5.08 appears to have been done for Java 1.5.

Similar Threads

  1. connection my mysql
    By pranjul137 in forum New To Java
    Replies: 5
    Last Post: 04-06-2010, 08:26 PM
  2. TWO IPs FOR MY MYSQL CONNECTION
    By tugalsan in forum JDBC
    Replies: 2
    Last Post: 03-21-2010, 08:46 PM
  3. Java-mysql connection
    By Kligham in forum New To Java
    Replies: 16
    Last Post: 11-25-2009, 01:28 PM
  4. java mysql connection
    By sysout in forum New To Java
    Replies: 5
    Last Post: 10-31-2009, 10:48 AM
  5. no mysql connection
    By scchia in forum New To Java
    Replies: 12
    Last Post: 07-19-2008, 07:57 PM

Posting Permissions

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