Does anybody know how to connect jboss-as-7.1.1 to PostgreSQL?
Does anybody know how to connect jboss-as-7.1.1 to PostgreSQL?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
(Note that this was written for JBoss AS 7.1.1; keep that in mind if on a newer version, as things might have changed.)
Download PgJDBC. I’m assuming you’re using
postgresql-9.1-902.jdbc4.jar, the current version at time of writing. Adjust any filenames to match if you need a different version.Now deploy the JDBC driver to JBoss AS 7 by putting it in the
deploymentsfolder or using thedeploycommand injboss-cli. This will work for most, but not all, purposes.Alternately, you an define a PostgreSQL JDBC driver module:
$JBOSS_HOME/modules/org/postgresql/main. Themodules/orgpart should already exist, make directories for the rest.In
$JBOSS_HOME/modules/org/postgresql/main/module.xmlwith the following content, changing theresource-rootentry for the PgJDBC driver to refer to the driver you wish to use.module.xmlplacepostgresql-9.1-902.jdbc4.jarjboss-cliby running$JBOSS_HOME/bin/jboss-cli --connectRun the command:
postgresql-driveras the driver name.You can create a datasource via the web ui, with
jboss-cliwith thedata-source createcommand (seedata-source --help,data-source add --help), or by deploying a-ds.xmlfile like this: