Forkmohit
Forkmohit

Reputation: 753

Openshift: Unable to connect to mysql using localhost

Trying to deploy my application on Openshift jboss/mysql gear. My hibernate.cfg.xml contains localhost/db_name as hibernate.connection.url. I would like to maintain it. But hibernate is unable to connect. If I explicitly mention bind_address that I see in my.cnf it works as expected.

Any idea, how can I map my localhost to that bind address? I can't edit my.cnf on Openshift.

Upvotes: 0

Views: 291

Answers (1)

user2879327
user2879327

Reputation:

You should be using the MySQL environment variables, not "localhost", as your MySQL instance is not listening on localhost. Refer to these two articles on OpenShift environment variables, and mysql in general, they should help you get your application running.

https://developers.openshift.com/en/managing-environment-variables.html https://developers.openshift.com/en/databases-mysql.html

Upvotes: 1

Related Questions