Why wont my driver load?

I quote the docs that come iwth the mysql driver: "The name of the class that implements java.sql.Driver in MySQL Connector/J is 'com.mysql.jdbc.Driver'. The 'org.gjt.mm.mysql.Driver' class name is also usable to remain backwards-compatible with MM.MySQL. You should use this class name when registering the driver, or when otherwise configuring software to use MySQL Connector/J."
I'm compileing with this command:
javac Select.java -classpath C:\;C:\mysql-connector-java-3.0.16-ga-bin.jar
But it keeps saying "Failed to load mySQL driver." What's wrong? My hairs going grey :(
import java.sql.*;
public class Select {
     public static void main(String[] args){
     String url = "jdbc:mysql://database.dcs.aber.ac.uk/cha2";
     Connection con = null;
     try {
          String driver = "com.mysql.jdbc.Driver";
          Class.forName(driver).newInstance();
          catch ( Exception e ) {
               System.out.println("Failed to load mySQL driver.");
               return;
          try{
               con=DriverManager.getConnection(url, "cha2", "mightymouse");
               Statement select = con.createStatement();
               ResultSet result = select.executeQuery("SELECT chaz FROM cha2");
               System.out.println("Got result");
          catch (Exception e){
               System.out.println("driver loaded(?), connection wrong(?)");
               e.printStackTrace();
          finally {
               if(con !=null) {
                    try{ con.close(); }
                    catch (Exception e) { e.printStackTrace(); }
}

I'm compileing with this command:
javac Select.java -classpath
C:\;C:\mysql-connector-java-3.0.16-ga-bin.jarI don't believe you need the JDBC JAR when you compile. You can compile like this:
javac -classpath Select.java
However, you absolutely need that JAR file when you run. Do it like this:
java -classpath .;C:\mysql-connector-java-3.0.16-ga-bin.jar Select
I'd recommend moving your Java source and that JAR file into a project-specific location (e.g, c:\DatabaseStuff). Create a source directory under that and put your .java code in there. Create a lib directory and put your 3rd party JARs in there. Learn Ant to automate your builds.
%

Similar Messages

  • Why wont apps store load on ipod5 wifi is on and signal is good

    Why wont apps store load on ipod 5. wifi is on and signal is good

    Using the battery level meter in this manner is comparable to using your car's fuel gauge to calculate miles per gallon.  The only thing that matters is the total amount of operating time from full charge to auto-shutdown.
    Use the wall-mount charger that came with the iPad and charge overnight.  Admittedly the labeling is hard to read but, if you use a magnifier and squint your eyes, you'll see "Output 5.1V, 2.1A."  The symbol between volts and amps is the symbol for DC.  Do NOT use an iPhone charger.  Do NOT use an iPod charger.  Do NOT use a computer's USB port.  Then, operate it normally until auto shut-down (ignore any low level alerts that may appear).  An irony is that doing that test to determine the total operating time is also the exact procedure necessary to calibrate the battery level meter.
    I'm not claiming that you do not have a problem.  I am stating, however, that we don't yet know whether or not a battery problem exists.
    According to Apple:
    Use Your iPad Regularly
    For proper reporting of the battery’s state of charge, be sure to go through at least one charge cycle per month (charging the battery to 100% and then completely running it down).
    Elsewhere, Apple elaborates and explains that two half-discharges (or four quarter-discharges, etc.) equals one full discharge.

  • Why wont my itunes load

    Why won't my itunes load?

    Well, we know nothing about which version of iTunes you are running, nor the computer on which you are running it, nor the operating system being run by the computer, nor the exact wording of error messages you are seeing...

  • Why wont home sharing load my library?

    it just continues to say its loading and it never does

    Hello Brennaelizabeth,
    Welcome to Apple Support Communities.
    You can do this in several ways. See the following article for how to transfer iTunes Store purchases using Home Sharing, an external drive, an iOS device (iPhone, iPad, or iPod), the Windows Migration Assistant, and CDs/DVDs:
    iTunes: How to move your music to a new computer
    http://support.apple.com/kb/HT4527
    Also you can authorize up to five computers to play purchases from each iTunes Store account. If you have multiple accounts, you should authorize each computer one time for each account.
    To authorize a computer in iTunes:
    1) In iTunes, click the Store pull-down menu at the top.
    2) Choose Authorize Computer.
    3) Enter your account name and password.
    4) Click Authorize.
    Hopw this helps

  • Why wont Youtube videos load when using Firefox 3.6.3?

    I've been having issues with youtube when using firefox, the video doesnt load or show up for that matter its just a black screen where the video should be and on the bottom left hand corner of Mozzilla it says "done" I've tried everything, I updated java and flash but nothing seems to work. What can I do? I know I can use other web browsers but I really want to fix this
    == URL of affected sites ==
    www.youtube.com

    There are a few reasons why youtube might be broken:
    * An extension may be causing the problem: try the steps at [[Troubleshooting extensions and themes]]
    * ''Bad item stored in the Browser Cache'': Follow the steps at [[How to clear the cache]].
    * Firewall software is blocking some resources on the page: see [[Firewalls]]
    If none of this works, let me know if Flash video from other sites work. Here are a few you can try:
    *[http://www.dailymotion.com/video/x9hvlb_3d-toy-story-3-2010-teaser-trailer_shortfilms]
    *[http://www.hulu.com]
    *[http://www.cuatro.com/el-hormiguero/videos]

  • Why wont InDesign CC load to my computer?

    Why won't In Design CC load to my computer?

    Do you get an error message? Does your system meet the minimum requirements?\
    You haven't provided any information, so there's really no way we can help you yet.

  • Why wont apple tv load content

    all network settings seem fine....the device wont load the content that i paid for!

    How have you verified that your network is fine?
    Did you check speedtest.net?
    8mbps required for instant 1080P
    Did you check istumbler.net for interference?
    Are you using your ISPs DNS?

  • Why wont Livejournal/Dreamwidth load in Safari on my iPhone?

    Everytime i try to load it, or an entry it tells me "too many redirects". Also, when i login with my correct info, it tells me i'm wrong!
    This is for both websites. Can anyone help?

    I had this same issue and finally just figured it out...I noticed that Livejournal was getting stuck in a loop trying to set its session cookies and this problem didn't arise on any of my desktop browsers, so I checked my Safari settings in iOS.   It turns out somehow my "accept cookies" setting had gotten changed from "visited" to "never."
    I have no idea how that happened, possibly it was my recent update to 5.1 but there's no way for me to be sure.  Anywys after I changed it back all sorts of web sites, including Livejournal, started behaving properly again on my phone.  Hope this helps!

  • Why wont my itunes load itunes store

    need help on why it does that

    Well, we know nothing about which version of iTunes you are running, nor the computer on which you are running it, nor the operating system being run by the computer, nor the exact wording of error messages you are seeing...

  • Why wont my iPhone load private message images on facebook?

    i have tried everything . HEEEEEEEEEEEEEEEEEELP

    Thank's JimHDK for your reply.
    Firstly this problem has only occured since i recently upgraded my phone from an Iphone 3.
    To be perfectly honest it has only happened when trying to load video pages on an explicit website.Namely Pornhub.
    I have tried restoring the phone although did not set it up as a new device, only restored to backup so as not to lose contacts etc.
    I did not have this problem with the old handset.

  • Why wont my game load it says there is an error and you can disable it and it says some can diable mine cant how do i disable it to play my game?

    For some reason when i go on fire fox i want to play my game it says it wont work because it has some kind of disabled thing and it say you can disable with a certain kind of computer and i don't have that computer and now how do i disable it?

    Hi Alyssa_fagundes,
    Thanks for the question. Based on what you stated, it seems like you need help restoring an iOS device. I would recommend that you read this article, it may be able to help you isolate or resolve the issue.
    If you can't update or restore your iPhone, iPad, or iPod touch - Apple Support
    Thanks for using Apple Support Communities.
    Cheers,
    Mario

  • Why wont the site load for cloud adobe

    I have sat on the side to download adobe creative cloud for over a hour and it will not load it only does the block spin i have even reloaded but the site is broken and will not load

    Windows :
    https://ccmdls.adobe.com/AdobeProducts/KCCC/1/win32/CreativeCloudSet-Up.exe
    Mac :
    https://ccmdls.adobe.com/AdobeProducts/KCCC/1/osx10/CreativeCloudInstaller.dmg

  • Why wont my facade load on my mac

    hi

    Judging by all the posts on the forum, there seems to be an issue at Apple's end, although they have made no announcement on their status page. Some users have reported that Apple is aware of the issue. You can leave feedback for Apple at the link below.
    http://www.apple.com/feedback/

  • Why wont apple tv 2 load my library ?

    why wont apple tv 2 load my library ? network is fine, wired connection, movies and music play over airplay, its just on atv main screen-computers just reads loading library ?

    This has been happening to me lately too.  The workaround I've been doing is quitting iTunes and reopening it.  After that, my AppleTV finds it right away.  Unfortunately, it's a temporary solution because it's happening every time I want to watch anything.

  • Why wont it load all my videos

    why wont it load all my videos

    A trick that sometimes works is to create a new administrator account and authorize from there.
    But are you able to connect to the iTunes store?
    It is worth checking the result of your network connectivity tests.
    iTunes>>Help>>Run Diagnostics>>Network Connectivity tests.
    Paste the entire result into you next post, but you can remove serial numbers.

Maybe you are looking for