How to avoid hardcoding Connection details in the datasource file?

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

jboss recipe of the day

If you don't want to hardcode the Connection details of your Datasource in the -ds.xml file, then you can just specify the Connection as a property:

<connection-url>${database.url}</connection-url>

then you can start-up JBoss passing the parameter database-url with the -D flag. Example:

run.sh -Ddatabase.url=jdbc:mysql://localhost:3306/myschema

You can even set up an additional Connection URL which will be used in case the first one (parameterized) will fail:

<connection-url>${database.url:jdbc:mysql://localhost:3306/myschema}</connection-url>

 

Related articles available on mastertheboss.com

How to deploy a DataSource in jboss at application level ?

  Do you need to deploy your DataSource along with your Enterpri

JBoss Datasource HA

This tutorial has been updated for the new release of JBoss Appli

JBoss run out of Connections ?

Have you got No ManagedConnections available error message ? well

How to connect to a DataSource from a remote client?

  If you want to connect to your JBoss Connection Pool from a re

JBoss Datasource configuration

A Datasource is a Java Naming and Directory Interface (JNDI) obje

How do I get the list of Datasources available ?

JBOSS AS 4/5 Users You can use either twiddle: $ twiddle.sh que

Follow us on Twitter