Home JBoss howto Persistence - Database How to avoid hardcoding Connection details in the datasource file?
30 | 07 | 2010
JBoss 5 AS Book
"JBoss AS 5 development" reviews
Please share your feedback/review with other readers!
Banner
Dashboard
Advertise with Us
Banner
RSS Feed
Java EE 1.6 resources
Login
Sign here for the NewsLetter.



JBoss admin resources
Banner
Java EE 1.6 resources
JBoss howto

How to avoid the 50 seconds start up limit in Eclipse ?

JBoss recipe of the day ...
Read More

How can you solve deployment errors caused by large war/jar/ear files ?

jboss recipe of the day ...
Read More

How do you configure your .war to be deployed after your EJB ?

jboss recipe of the day ...
Read More
How to avoid hardcoding Connection details in the datasource file?
Written by Mark S.   

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>

 


JBoss.org Search
Custom Search
Comments
Search
Only registered users can write comments!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."