简体   繁体   中英

How can I access Heroku ClearDB in my Java web application?

I have done add-on Heroku of ClearDB and I want to access that database using Hibernate in my Java web application..

I have added the connection to MySQL workbench too.

You have to add the following properties into your hibernate.cfg.xml file.

<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://us-cdbr-iron-east-03.cleardb.net:3306/heroku_123456789?zeroDateTimeBehavior=convertToNull</property>
<property name="hibernate.connection.username">my_username</property>
<property name="hibernate.connection.password">my_passsword</property>

Please note that the property value of the hibernate.connection.url is a sample only. But it has the URL format. You have replace it with your own URL.

Property values of hibernate.connection.username and hibernate.connection.password should also be replace.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM