JaapM
JaapM

Reputation: 121

Hibernate: Can't connect to MySQL database

I'm struggling to get my program to connect to a MySQL database with Hibernate.

I simply want to connect to it so i can usee Hibernate tools to reverse engineer a few tables in the database. When i use MySQL Workbench to connect to the database from the same machine, it works.

Here's my hibernate.cfg.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://www.soosthebasement.nl:3306/soos_thebasement</property>
        <property name="hibernate.connection.username">removed</property>
        <property name="hibernate.connection.password">removed</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    </session-factory>
</hibernate-configuration>

The password contains some weird chars, like >, which when creating the cfg file got parsed into &gt;. Could that have something to do with it?

Upvotes: 1

Views: 1947

Answers (1)

JaapM
JaapM

Reputation: 121

Turns out i used the wrong URL. Even though the URL listed in the question points to the correct website, it doesn't actually point to the database host.

Upvotes: 1

Related Questions