And remember to copy Mysql driver jar into tomee/lib On 4 September 2017 at 15:08, Paul Carter-Brown < paul.carter-br...@smilecoms.com> wrote:
> Assuming you are using JPA, here is an example of a JTA persistence.xml in > your war/ear WEB-INF or META-INF: > > <?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="SOME_NAME" transaction-type="JTA"> > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</ > provider> > <jta-data-source>jdbc/ANOTHER_NAME</jta-data-source> > <exclude-unlisted-classes>false</exclude-unlisted-classes> > </persistence-unit> > </persistence> > > > > Then a connection pool in tomee.xml: > > > <?xml version="1.0" encoding="UTF-8"?> > <tomee> > <!-- see http://tomee.apache.org/containers-and-resources.html --> > > <!-- activate next line to be able to deploy applications in apps --> > <Deployments dir="apps" /> > > <Resource id="jdbc/ANOTHER_NAME" type="javax.sql.DataSource" > jndi="jdbc/ANOTHER_NAME"> > > JdbcDriver com.mysql.jdbc.Driver > JdbcUrl jdbc:mysql://_MYSQLHOST_/SchemaName > JtaManaged true > UserName _MYSQLUSER_ > Password _MYSQLPASS_ > DefaultAutoCommit false > DefaultTransactionIsolation 2 > MaxActive 200 > MaxWait 2500 > MinIdle 20 > MaxIdle 200 > InitialSize 10 > TestWhileIdle true > ValidationQuery select 1 > TimeBetweenEvictionRunsMillis 10000 > MinEvictableIdleTimeMillis 180000 > ConnectionProperties useSSL=false;autoReconnect= > true;failOverReadOnly=false;connectTimeout=1000;socketTimeout=130000 > </Resource> > </tomee> > > > In Docker you can run the containers using --network=host so that the > containers bind to your host IP. Then TomEE should be on your host Ip and > port 8080 and MySQL on your host IP and port 3306 > > On 4 September 2017 at 12:33, mauro2java2011 <mauro2java2...@gmail.com> > wrote: > >> Hi all. >> I found this https://docs.docker.com/samples/library/tomee/ >> <https://docs.docker.com/samples/library/tomee/> >> >> Image of tomee . >> >> Now i would use this image ofbtomee with a image of mysql. >> >> I know is possible linking the 2 container. >> >> But my question is : >> >> how to configure the datasouce into tomee.xml or resource.xml using the >> db setted into mysql container? >> >> Ho i can alter the tomee.xml that came from imahpge above for set the >> datasource mysql? >> >> Please do you have a exampke of use tomee and mysql and con figure the >> datasource using docker? >> >> Tank you in Advance >> MAURO >> >> >> >> >> >> -- >> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f97944 >> 1.html >> > > > > -- > > *Paul Carter-Brown* > > *Group Chief Information Officer* > > *Smile Communications Pty (Ltd) * > Smile +234 (0) 702 000 1234 <+234%20702%20000%201234> > Mobile +27 (0) 83 4427 179 > Skype PaulC-B > paul.carter-br...@smilecoms.com > www.smilecoms.com > -- *Paul Carter-Brown* *Group Chief Information Officer* *Smile Communications Pty (Ltd) * Smile +234 (0) 702 000 1234 Mobile +27 (0) 83 4427 179 Skype PaulC-B paul.carter-br...@smilecoms.com www.smilecoms.com -- This email is subject to the disclaimer of Smile Communications at http://www.smilecoms.com/home/email-disclaimer/ <http://www.smilecoms.com/disclaimer>