Ritesh
Ritesh

Reputation: 650

Hibernate:Connections could not be acquired from the underlying database

I am new to hibernate, I now how to connect Local DB from hiibenate.cfg ,but now I want to access DB which is not local?? how can I can any one help me??

Upvotes: 0

Views: 4043

Answers (2)

mkazma
mkazma

Reputation: 582

change the property name hibernate.connection.url from local to your desired database IP address like this:

<property name="hibernate.connection.url">
  jdbc:mysql://192.168.12.35:3306/test
</property>

Upvotes: 0

Vimal Bera
Vimal Bera

Reputation: 10497

Just replace the connection url property in config file to your remote database url.

For ex :

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

This will used to connect local test db. Now change it to something like :

<property name="hibernate.connection.url">
  jdbc:mysql://192.168.12.35:3306/test
</property>

This will connect to remote database test which is running on 192.168.12.35 ip.

Upvotes: 2

Related Questions