I need to configure MySQL in CloudBees, how can I do this? Can anyone help me configure this connection for use in JBoss?
I need to configure MySQL in CloudBees, how can I do this? Can anyone help me configure this connection for use in JBoss?
As mentioned by the user @ user6053 the configuration needed to use MySQL in CloudBees consists of configuring three files basically:
cloudbees-web.xml (the file should be created in the WEB-INF folder)
<?xml version="1.0" encoding="UTF-8"?>
<cloudbees-web-app xmlns="http://www.cloudbees.com/xml/webapp/1">
<!-- Application ID (formatted CB_ACCOUNT/APPNAME) -->
<appid>geisonsn/webbusam</appid><!-- ID da minha aplicação no CloudBees-->
<!-- DataSources (use names refererenced via <resource-ref> in WEB-INF/web.xml) -->
<resource name="jdbc/webbusam" auth="Container" type="javax.sql.DataSource">
<param name="username" value="USUARIO" />
<param name="password" value="SENHA" />
<param name="url" value="jdbc:mysql://us-cdbr-cb-east-01.cleardb.net:3306/cb_dbbusam" />
<!-- Connection Pool settings -->
<param name="maxActive" value="20" />
<param name="maxIdle" value="2" />
<param name="maxWait" value="10000" />
<param name="validationQuery" value="SELECT 1" />
</resource>
</cloudbees-web-app>
web.xml
<resource-ref>
<res-ref-name>jdbc/webbusam</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="primary">
<non-jta-data-source>java:comp/env/jdbc/webbusam</non-jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
</properties>
</persistence-unit>
</persistence>
Important: The example application uses the JBoss7 server.
References