Configuring JBoss to use PostgreSQL
These notes are based on JBoss 3.2.6 and PostgreSQL 7.4 running on Mandrake Linux 10.0
For JBoss 3.0.6 see JbossPostgreSql
I'm not sure which items are case-significant. Play safe and assume they all are!
Refer to the instructions at http://www.postgresql.org/docs/7.4/static/jdbc.html for details on obtaining the PostgreSQL JDBC driver.
Copy the appropriate JDBC driver to (e.g. pg74.1jdbc3.jar) to jboss/server/xxx/lib
Copy jboss/docs/examples/jca/postgres-ds.xml to jboss/server/xxx/deploy directory
Amend the connection properties appropriately.
<connection-url>jdbc:postgresql://localhost:5432/mydb</connection-url>
<user-name>username</user-name>
<password>userpassword</password>
In the PostgreSQL data directory, amend postgresql.conf file to enable TCP/IP connections.
- tcpip_socket = true
Also in the PostgreSQL directory, amend pg_hba.conf file to allow TCP/IP connections from the local host. (Note: This isn't secure. Read the very good PostgreSQL documentation.
- host all all 127.0.0.1/32 trust
Make sure both these files have the correct ownership, otherwise the PostgreSQL server will fail to run. Owner should probably be something like postgres. Restart the PostgreSQL server.
Note: These instructions will leave JBoss using Hypersonic for the jbossmq persistence manager. Options to consider persuing are:
Change the mq persistence manager to use the PostgreSQL datasource
Change jbossmq to use a non-jdbc persistence manager
Rename or copy the PostgreSQL datasource to DefaultDS
See also PostgreSQL, MySql, JbossHintsAndTips, JbossMySql
-- Frank Dean - 09 Feb 2005