MySQL Database connection for OpenShift 2

51 Views Asked by At

I have 2 cartridges in OpenShift 2, one for Tomcat 7 where my war is deployed and the other is a MySQL cartridge where I am hosting my DB. This is my context.xml file

<Context>
<Resource
  name="jdbc/src"
  type="javax.sql.DataSource"
  maxActive="4"
  maxIdle="2"
  username="admin****I"
  maxWait="5000"
  validationQuery="select 1"         
  driverClassName="com.mysql.jdbc.Driver"
  password="########"     
  url="jdbc:mysql://pi-******.rhcloud.com:3306/pi"/>

</Context> 

My URL where I access the application is pi-******.rhcloud.com and my DB name in MySQL cartridge is pi, so is my context.xml correct? Is this how I connect to the DB from a war deployed on OpenShift?

0

There are 0 best solutions below