Rain
Rain

Reputation: 11

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306

Hi please help I've been using Apache Tomcat as server and I got errors the detail are stated below. Thank you.

In pom.xml I already have

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.21</version>
    </dependency>

I have the following in persistence.xml file

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/activiti" />
<property name="hibernate.connection.driver_class" value="com.p6spy.engine.spy.P6SpyDriver" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="" />
<property name="hibernate.hbm2ddl.auto" value="update" />

I got error like the following

2014-10-30 14:24:11,335 [localhost-startStop-1] ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - HHH000319: Could not get database metadata
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/activiti
    at java.sql.DriverManager.getConnection(DriverManager.java:596)
    at java.sql.DriverManager.getConnection(DriverManager.java:187)

Upvotes: 0

Views: 3273

Answers (3)

Chris Sim
Chris Sim

Reputation: 4132

go to http://dev.mysql.com/downloads/connector/j/ and press download to download mysql-connector-java then press no thanks

and go to netbeans right click your project - properties - Library - add jar file - and go to downloads and choose the downloaded jar file

For me that fixed the problem .. hope I could help you :)

Upvotes: 0

Jens
Jens

Reputation: 69440

Change <property name="hibernate.connection.driver_class" value="com.p6spy.engine.spy.P6SpyDriver"/> to <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /> to use the right driver class.

Upvotes: 0

AsSiDe
AsSiDe

Reputation: 1846

Place you Database Specific JDBC .jar file in /WEB-INF/lib

Upvotes: 3

Related Questions