Help with MySQL

Discussion in 'Plugin Development' started by Abrupt, Apr 20, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Abrupt

    I've downloaded the Connector/J and included mysql-connector-java-5.1.15-bin.jar in my Java Build Path, yet I keep getting a "ClassNotFoundException: com.mysql.jdbc.Driver" on what I assume to be this line: "Class.forName("com.mysql.jdbc.Driver").newInstance();" (there was no line number provided)

    does anyone know what I'm doing wrong?
     
  2. Offline

    phondeux

    You need to do one of the following;
    1. Roll the mysql connector into your plugin.
    2. Put the path to the mysql connector in your manifest.mf file.
    3. Put the mysql connector in the following directory; <java_install>/jre6/lib/ext/
     
    Abrupt likes this.
  3. Offline

    Abrupt

    I've tried #3, and it didn't work. not sure how to edit the manifest.mf file, nor sure what you mean by "rolling" the MySQL connector into my plugin. but since you said one of the following, I'm assuming that the placement of the connector in #3 should have fixed it. any thoughts?
     
  4. Offline

    phondeux

    If I were you, I would spam every ext directory under the java tree until it works, because it will.

    Under windows it worked for me here;
    C:\Program Files (x86)\Java\jre6\lib\ext
    In Linux it worked for me here;
    /usr/lib/jvm/java-6-openjdk/jre/lib/ext
    and here;
    /usr/lib/jvm/jdk1.7.0/jre/lib/ext
    (two different servers)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
    Abrupt likes this.
  5. Offline

    Abrupt

    yeah, I'm currently trying to get it work on my windows machine, where the path is "C:\Program Files (x86)\Java\jre6\lib\ext" yet it is not working :(

    edit:
    here's a screenshot
    [​IMG]

    as you can see, the JAR file is in there.
     
  6. Offline

    phondeux

    Hmm ... what do you have set as your java_home? At a CMD prompt, type this;
    Code:
    echo %JAVA_HOME%
     
    Abrupt likes this.
  7. Offline

    Abrupt

    it just returned %JAVA_HOME% again. strange.
     
  8. Offline

    phondeux

    Okay, just type 'set' but without the quotes. That should list all of your variables. The JAVA_HOME should be in there. Or, you can go into your system and check your environmental variables and see if it's in there.
     
    Abrupt likes this.
  9. Offline

    Abrupt

    I didn't see it in there, so I added it and it works now. thanks for all your help
     
  10. Offline

    phondeux

    I'm glad to read that! It was very frustrating to setup on my first attempt so I'm glad to help others get it working. :)
     
Thread Status:
Not open for further replies.

Share This Page