tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mauro2java2011 <mauro2java2...@gmail.com>
Subject declare datasource into tomee.xml with variable env of mysql Openshift
Date Sat, 01 Feb 2014 17:51:42 GMT
hi. i would i*install tomee* with diy into openshift. from :

https://github.com/openshift-quickstart/openshift-tomcat-quickstart
<https://github.com/openshift-quickstart/openshift-tomcat-quickstart>  

ON openshift i would active  also mysql  .

>From openshift i can get the value of variable env of db and other .

https://www.openshift.com/page/openshift-environment-variables
<https://www.openshift.com/page/openshift-environment-variables>  

NOw i would create into tomee.xml a Reosuce for a datasource without hard
code the value , but use the variable env .

Like i have to make it?
i have to export a Variable env woth the -Dproerties that reference at
$(OPENSHIFT_MYSQL_host , and into tomee.xml referce it with:
$(nameofsystempropetriessettovariableexported)
 ?


example: 
openshift variables available for mysql:
OPENSHIFT_MYSQL_DB_HOST 	127.0.250.1 	The hostname or IP address to use to
connect to 
OPENSHIFT_MYSQL_DB_PORT 	3306 	The port your database server is listening on
OPENSHIFT_MYSQL_DB_USERNAME 	admin 	Your database administrative username
OPENSHIFT_MYSQL_DB_PASSWORD


into the 
openshift-tomcat-quickstart /.openshift /action_hooks /start file that it is
called from the openshift when i push , i have to add:

export JAVA_OPTS_EXT="-Dmydbhost=$OPENSHIFT_MYSQL_DB_HOST
-D=mydbport=$OPENSHIFT_MYSQL_DB_PORT
-Dmydbusername=$OPENSHIFT_MYSQL_DB_USERNAME 
-Dmydbpassword=$OPENSHIFT_MYSQL_DB_PASSWORD
-Dmydburl=$OPENSHIFT_MYSQL_DB_URL"  ?????

 FOR get the values into java  system properties -

And into the tomee.xml , into the declaration of resource of db:

<Resource id="myapp_mysqDBl" type="DataSource">
  JdbcDriver  com.mysql.jdbc.Driver
  JdbcUrl   ${mydburl}
  UserName    ${mydbusername}
  Password  ${mydbpassword}
  JtaManaged true
</Resource>

Then  from the persistence.xmol into my web apps i reference only with :
<JTA-DATASOURCE>myapp_mysqlDB</JTA_DATASOURCE>

PLEase the procedure it is correct of  

*export JAVA_OPTS_EXT="-Dmydbhost=$OPENSHIFT_MYSQL_DB_HOST
-D=mydbport=$OPENSHIFT_MYSQL_DB_PORT
-Dmydbusername=$OPENSHIFT_MYSQL_DB_USERNAME 
-Dmydbpassword=$OPENSHIFT_MYSQL_DB_PASSWORD
-Dmydburl=$OPENSHIFT_MYSQL_DB_URL"  ?????*
and referecne at properties int othe tomee.xml  ?




--
View this message in context: http://openejb.979440.n4.nabble.com/declare-datasource-into-tomee-xml-with-variable-env-of-mysql-Openshift-tp4667423.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message