[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Creating JDBC Datasources/Conn Pools from the cmd line?

PeterJ do-not-reply at jboss.com
Tue Aug 19 13:41:50 EDT 2008


The best way to create a datasource is to:

1) Create a *-ds.xml file
2) Copy/move the file to the deploy directory

In my build process, I have a generic *-ds.xml file that contains properties for various items. For example:

<jndi-name>${db.datasource}</jndi-name>
  |     <connection-url>${db.url.base}${db.database}</connection-url>

Then in my Ant script, or properties file, I set the db.* properties and I copy the file as follows:

   <copy file="${db.dsxml}"
  |           tofile="${dir.deploy}/${jboss.server}-${database.type}-ds.xml"
  |     >
  |       <filterchain>
  |         <expandproperties />
  |       </filterchain>
  |     </copy>

My Ant script is set up to allow the MySQL, PostgreSQL or Hypersonic databases. Every aspect of the datasource is configurable from the database name down to the user name and password. I can easily switch from using PostgreSQL to MySQL - it is a one-line properties file change.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171342#4171342

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171342



More information about the jboss-user mailing list