Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help- unable to connect to MySQL Connector/J

 
Ashish Dutt
Ranch Hand
Posts: 172
Java MySQL Database Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 172
Java MySQL Database Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic