0

EDIT: I have gone through No suitable driver found for 'jdbc:mysql://localhost:3306/mysql and several other questions on SO. But my question is not answered anywhere. It is different.

I am using Jetty, Maven and Hibernate for connecting to MySQL. Here is my src/main/resources/META-INF/persistence.xml file:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
        version="2.0">

    <persistence-unit name="world">
      <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

      <properties>
        <!-- 
        <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
         -->
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/world"/>
        <property name="javax.persistence.jdbc.user" value="root"/>
        <property name="javax.persistence.jdbc.password" value="password"/>
        <property name="hibernate.show_sql" value="true"/>
        <property name="hibernate.format_sql" value="true"/>
      </properties>
    </persistence-unit>
</persistence>

The database I am using with MySQL is the default one that comes with MySQL and is called world. Here is a screenshot from MySQL's Workbench. enter image description here

Yet, I am not able to connect.

Dependencies I have in my project are:

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-core</artifactId>
  <version>5.0.0.CR4</version>
</dependency>
<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-entitymanager</artifactId>
  <version>5.0.0.CR4</version>
</dependency>
<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-annotations</artifactId>
  <version>3.5.6-Final</version>
</dependency>
<dependency>
  <groupId>org.hibernate.javax.persistence</groupId>
  <artifactId>hibernate-jpa-2.0-api</artifactId>
  <version>1.0.1.Final</version>
</dependency>

Please help!

Community
  • 1
  • 1
user2250246
  • 3,807
  • 5
  • 43
  • 71

0 Answers0