wood burning stoves
The moose likes JDBC and Relational Databases 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


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 43350
    
  32
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;
 
Consider Paul's rocket mass heater.
 
subject: Help- unable to connect to MySQL Connector/J
 
It's not a secret anymore!