Reputation: 1
I am using Hibernate on OpenShift now.
In hibernate.cfg.xml
When I use:
<property name="connection.url">jdbc:mysql://10.143.140.62:52016/yoodp</property>
It works.
But when I use:
<property name="connection.url">jdbc:mysql://${env.OPENSHIFT_MYSQL_DB_HOST}:${env.OPENSHIFT_MYSQL_DB_PORT}/${env.OPENSHIFT_APP_NAME}</property>
or
<property name="connection.url">jdbc:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME}</property>
It doesn't work.
How can I fix it?
Upvotes: 0
Views: 1072
Reputation: 231
I'm guessing you're using Openshift Tomcat, so to connect to your MySQL database simply use the datasource that is already defined for you.
The JNDI datasource is named jdbc/MySQLDS and you use it in hibernate with the connection.datasource property.
Upvotes: 2
Reputation: 4071
${env.OPENSHIFT_MYSQL_DB_HOST}:${env.OPENSHIFT_MYSQL_DB_PORT}/${env.OPENSHIFT_APP_NAME}
these are the OpesnShift variables. you cant use them for configuration. They should be replaced by their real values which you have done for the first one.
Upvotes: 0