1

I am trying to replace PostgreSQL in my application with MySQL. I thought that it should be sufficient to replace the <properties> in persistence.xml file:

PostgreSQL:

<property name="hibernate.connection.url" value="jdbc:postgresql://localhost/postgres"/>
<property name="hibernate.connection.username" value=""/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
<property name="hibernate.show_sql" value="true"/>

MySQL:

<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hiberante.connection.url" value="jdbc:mysql://localhost:3306/GoOut2"/>
<property name="hibernate.connection.username" value=""/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>

But with this replacement, I amg getting

java.lang.UnsupportedOperationException: The application must supply JDBC connections

I am not sure what I am doing wrong, I just hoped that the replacement would be straightforward. In PostgreSQL, everything works correctly.

Persistence.xml: https://gist.github.com/2252443

applicationContext.xml: https://gist.github.com/2252463

exception: https://gist.github.com/2252487

Thanks!

EDIT: I remove username and password from the given code intentionally.

2
  • can you post the startup messages for the session factory as well? Commented Mar 31, 2012 at 8:16
  • can you connect from mysql workbench with the given credential information? Commented Mar 31, 2012 at 16:54

2 Answers 2

6

You missing configuration hibernate dialect for PostgreSQL:

<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>

EDIT:

You have miss spelling in configuration:

<property name="hiberante.connection.url" value="jdbc:mysql://localhost:3306/GoOut2"/>

should be

<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/GoOut2"/>

Is hibernate, but not hiberante.

Sign up to request clarification or add additional context in comments.

1 Comment

I just forgot to add it to the example, but my problem is not PostgreSQL, byt MySQL.
1
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/demo</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">root</property>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.