PostgreSQL database is one of the most commonly used open-source relational databases. The first step is to get the database driver classes into the runtime classpath of JBoss application server. The JDBC 4.0 driver for PostgreSQL database may be obtained from http://jdbc.postgresql.org/download.html. Copy the PostgreSQL driver JAR file postgresql-8.2-507.jdbc4.jar
to the JBoss installation's /server/default/lib
directory. We also need to set the JAVA_HOME
environment variable to JDK 6.0 and then use its data source by copying /docs/examples/jca/postgres-ds.xml
to the /server/default/deploy
directory.
Modify the postgres-ds.xml
configuration file by setting<driver-class/>
to org.postgresql.Driver
and<connection-url/>
to jdbc:postgresql://localhost:5432/postgres
.
Finally, modify \server\default\conf\login-config.xml
to use the PostgreSQL database and add the following<application-policy/>
element to the file:
<application...