i am trying to get connected to my data base with Hibernate but it kips telling me : Cannot open connection. i am new at this so i may have done some thing wrong
or missed some step(more likely).
Did you make any progress on your issue?
Just in case I found the following from mysql documentation:
220.127.116.11.2: My application throws an SQLException 'No Suitable Driver'. Why is this happening?
There are three possible causes for this error:
1 The Connector/J driver is not in your CLASSPATH, see Section 19.3.2, “Connector/J Installation”.
2The format of your connection URL is incorrect, or you are referencing the wrong JDBC driver.
3When using DriverManager, the jdbc.drivers system property has not been populated with the location of the Connector/J driver.
As you dont use DriverManager it is either 1 or 2.
The url "jdbc:mysql://localhost:3306/haimgavriel" looks fine.
You seem to be using Tomcat so make sure the driver is in the servervclasspath for tomcat 6+ its TOMCAT_HOME/lib.
Thank you for replying
Yes, i am still on it, i have been so busy the past 3 days.
any way, i have tried to relocate the driver file and it didn't worked as: external, web app or tomcat lib.
Don't know why but when i putted the driver file as external jar it sad: Null pointer exception, like he didn't see it.
so it is now in my tomcat lib.
the interesting thing is that when i am using the driver manager as:
and in the same session i am using hibernate the first one does work, the hibernate don't. (same problem)
then i thought maybe i broke some limit, so i tried to use only hibernate..still, same problem remains.
maybe something to do with a class i am using to initialize FactorySession:
It may be working with the driver in the jre/lib/ext but this is only a solution acceptable in a local dev environment.
You need to figure out why your server cannot see the JDBC driver in its lib folder. It will benefit you in the future.
Nice work around anyway.
I needed to create a small hibernate project for some other business of mine.
It uses hibernate 3, mysql 5 and tomcat 6 and works just fine.
I could package it with tomcat and send it over to you for comparison if you wish to.
Send me private msg for that
SCJP 5 , SCWCD 5, SCEA 5
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop