jQuery in Action, 3rd edition
The moose likes Object Relational Mapping and the fly likes problem with using hibernate on a remote host Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "problem with using hibernate on a remote host" Watch "problem with using hibernate on a remote host" New topic

problem with using hibernate on a remote host

Vince Lee

Joined: Oct 15, 2006
Posts: 7

I have recently finished writing a web application locally, and have deployed the application on a remote host. However, I am having trouble making a connection to the mysql database using hibernate. The situation is this:

1. my application runs on tomcat on server A
2. the mysql database is on a server "mysql5" that is accessible from server A using the name "mysql5". ie. i could access it in a ssh session using mysql -p -u owasclub -h mysql5 owasclub
3. in my hibernate.cfg.xml (under web-inf and root dir), I have:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"

<!-- mysql db settings -->
<property name="connection.url">jdbc:mysql://mysql5/owasclub</property>
<property name="connection.username">owasclub</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.password">xxxx</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>

<!-- thread is the short name for org.hibernate.context.ThreadLocalSessionContext and let Hibernate bind the session automatically to the thread -->
<property name="current_session_context_class">thread</property>

<!-- this will show us all sql statements -->
<property name="hibernate.show_sql">true</property>


4. I am using the newest mysql driver (5.x)

The error that I am getting is a TransactionException, Transaction not successfully started. I currently don't have the stack trace because i don't know how to get it saved remotely.

The application used to work when the database was on localhost, so I'm wondering if there's something that has to be done extra for connecting remotely. Any information would be appreciated. Thanks.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Just out of curiosity in


What is the ip ort address of the server?


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link: http://aspose.com/file-tools
subject: problem with using hibernate on a remote host
It's not a secret anymore!