2
I need to set up Mysql on Cloudbees, how can I do this? Someone who has already done this can help me set up this connection to be used on Jboss?
2
I need to set up Mysql on Cloudbees, how can I do this? Someone who has already done this can help me set up this connection to be used on Jboss?
2
1
As mentioned by the user @user6053 the configuration needed to use Mysql in Cloudbees consists of the configuration of three files basically:
cloudbees-web.xml (the file must 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
Browser other questions tagged jboss cloud integration
You are not signed in. Login or sign up in order to post.