File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • 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
  • 0
  • 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
Pie
Posts: 47229
52
  • 0
  • 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
  • 0
  • 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;
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic