• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with using hibernate on a remote host

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

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"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<!-- 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>

...
</session-factory>
</hibernate-configuration>

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.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just out of curiosity in

"jdbc:mysql://mysql5/owasclub"

What is the ip ort address of the server?

Mark
 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic