If you’re using jboss and you’re storing database connection info in a properties file, you might be doing something wrong. Specifically, you’re probably not using the data source files jboss ships with to configure all that plumbing.
What’s a Datasource file?
Simply put, its a file that contains all the connection properties an application needs in order to connect to a database in xml format. Here’s an example:
<datasources>
<local-tx-datasource>
<jndi-name>DefaultDS</jndi-name>
<connection-url>jdbc:postgres://dbUrl:5432/schema</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<user-name>username</user-name>
<password>password</password>
<metadata>
<type-mapping>PostgreSQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
So, the “jndi-name” node gives this datasource configuration the jndi name it will be bound to…
[Read the rest]