It's not a secret anymore!*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 37953
    
  22
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
 
Similar Threads
Error while inserting data in database using jsp
PreparedStatement to pass user input to MySQL not working
MySQL Connector/J
General error can any body solve this problem
Getting null values in database while edit.jsp