This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

No suitable driver found for jdbc connection.  RSS feed

 
Ranch Hand
Posts: 176
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm getting error - No suitable driver found for No suitable driver found for jdbc:mysql:thin:@localhost/jdbcdemo



I'm using eclipse. I have "mysql-connector-java-5.1.21.jar" added as referenced libraries.

Database name - jdbcdemo
Table name - students.
 
Ranch Foreman
Posts: 1024
24
IBM DB2 Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please verify if the connection url you used in the connection string is valid for MySQL. JDBC (4.0 ? not sure if the same applies to previous versions as well) checks if there is a driver accepting a given connection url.
 
Shubham Semwal
Ranch Hand
Posts: 176
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Connection con = DriverManager.getConnection("jdbc:mysql:thin://localhost/jdbcdemo","root","");

No idea what is being done here. I've installed wamp server and created db there. My database name is jdbcdemo.
MySQL version - 5.6.12

profile being used in MySQL : Username - root password -"".
 
Saloon Keeper
Posts: 5041
134
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
+1 on what Claude said - the "thin:" part looks fishy. Where did you get that from?
 
Shubham Semwal
Ranch Hand
Posts: 176
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I removed "thin". Now its working but I'm super confused.
I gues I mixed syntaxes for OracleDB and Mysql :
Oracle : jdbc: oracle:thin:@localhost:1521:xe
MySQL : jdbc:mysql://localhost/jdbcdemo

I thought "thin" is used for a driver. Why aren't we using that in MySQL syntax ?
 
Tim Moores
Saloon Keeper
Posts: 5041
134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "thin" part is an Oracle thing; it does not apply to MySQL. Actually, the entire part after the 2nd colon is specific to the driver, so there's a lot of variety.
 
Shubham Semwal
Ranch Hand
Posts: 176
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot @tim and @claude
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!