File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Help- unable to connect to MySQL Connector/J  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Help- unable to connect to MySQL Connector/J  " Watch "Help- unable to connect to MySQL Connector/J  " New topic
Author

Help- unable to connect to MySQL Connector/J

Ashish Dutt
Ranch Hand

Joined: Apr 12, 2013
Posts: 172

Dear all,
I am using netbeans IDE
I followed the steps at JDBC connectivity
But i get the exception, "No suitable driver found".
I have already downloaded the MySql Coonector/J and placed the "mysql connector java.jar file" in the ext folder of jre.
I have also added the location in the Classpath variable
Do help please.
Following is the code


Still a beginner at crafting quality coding but have the zeal to learn more. Your help would be appreciated.
My Blog on Learning Analytics
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
Please print the exact path to the connector file, and the exact classpath you are using.
I do not like the practice of re‑throwing an unchecked Exception. Simply print the Exception and its stack trace. Remember an SQLException has two fields which other Exceptions don't, so you should make sure to print them, too.
Ashish Dutt
Ranch Hand

Joined: Apr 12, 2013
Posts: 172

Thanks Campbell for the reply.

Following is the stack trace for this code

The classpath is: .;C:\Program Files\Java\jre7\lib\ext\QTJava.zip;C:\Program Files\Java\jre7\lib\ext\mysql-connector-java-5.1.25-bin.jar;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help- unable to connect to MySQL Connector/J