wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes problem with jdbc driver 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 » Object Relational Mapping
Bookmark "problem with jdbc driver" Watch "problem with jdbc driver" New topic

problem with jdbc driver

fabian verbeek
Ranch Hand

Joined: Oct 20, 2012
Posts: 52

I'm learning java and now i'm at the chapter with hibernate.
I started by downloading the source and put the jar content in the folder required in my lib directory.
My jar mysql_connector_java is under the directory lib in my lib tomcat folder.

Every jar are added in the java build path

I added the hibernate.cfg.xml file with this

I tried to connect me in console in mysql and it works with: mysql -u root
I created my database gestImmo and a table user.

here i'm the next step, add hibernate mapping file and i have an issue in eclipse (i'm using mac os x lion):

In front of Driver: com.mysql.jdbc.Driver
database URL : jdbc://mysql://localhost/gestImmo
username : root
password :

When i click refresh to see my available tables i've the following error:
this is most likely due to the url not matching the expected value by the jdbc driver. please verify your setting

thanks a lot for your help
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

That database URL doesn't look correct. Here's a link to the documentation on the MySQL site: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html.
fabian verbeek
Ranch Hand

Joined: Oct 20, 2012
Posts: 52
great reply and fast.

thanks a lot, the correct url was : jdbc:mysql://localhost:3306/gestImmo
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

3306 is the MySql default port. Remember that if you ever change the port in MySql config, to also update the connection strings.

It is sorta covered in the JavaRanch Style Guide.
subject: problem with jdbc driver
Similar Threads
Error ##### org.hibernate.exception.GenericJDBCException: Cannot open connection
org.hibernate.exception.GenericJDBCException: Cannot open connection
runtime exception getting when i execute hibernate program
Cannot connect to MySQL server ...
Unable to create schema