Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2011
    Posts
    2

    Unanswered: mysql/java/apache driver issue - help!

    Hi
    I am a complete novice with mysql and know almost nothing about software/program networking.

    I basically have a problem trying to get mysql (5.1) to recognice and talk to java and apache-ant.

    I'm currently working in a windows CMD shell and have already had issues with the defining the host name (this is how basic i am!!). I think i have that sorted now, but still keep getting this message -

    ---------------------------------------------------
    Exception in thread "main" org.apache.commons.dbcp.SQLNestedException: Cannot cr
    eate JDBC driver of class 'org.gjt.mm.mysql.Driver' for connect URL 'jdbc:sqlser
    ver://localhost:101/test', cause:
    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(DriverManager.jav a:264)
    at org.apache.commons.dbcp.BasicDataSource.createData Source(BasicDataSou
    rce.java:743)
    at org.apache.commons.dbcp.BasicDataSource.getConnect ion(BasicDataSource
    .java:518)
    ---------------------------------------

    Can anyone please help me and offer some novice-level instuction?!!

    Cheers, and sorry if this is a familiar question.

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    It looks like JDBC is installed but you are missing the corresponding driver for MySQL. JDBC sits on top of drivers for the various databases. This way you can easily change the driver to other databases without impacting your JDBC calls in your application (at least that is the theory). Check this link to download the MySQL driver for JDBC.
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  3. #3
    Join Date
    Mar 2011
    Posts
    2
    Hi

    Thanks for the link. I actually already have the driver installed but had the wrong version listed in my classpath.

    Now i have a different error message!

    --------------------------
    Exception in thread "main" org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.gjt.mm.mysql.Driver', cause:
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    at java.net.URLClassLoader$1****n(URLClassLoader.java :202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at org.apache.commons.dbcp.BasicDataSource.createData Source(BasicDataSou
    rce.java:730)
    at org.apache.commons.dbcp.BasicDataSource.getConnect ion(BasicDataSource
    .java:518)

    ----------------------------------------

    Erm... sorry to be useless but could you point me in the right direction?

  4. #4
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    The correct classname for the MySQL driver ist: com.mysql.jdbc.Driver

Posting Permissions

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