-
15. Re: Postgres Datasource
spyderdyne Jul 12, 2012 12:59 PM (in response to spyderdyne)Issue resolved. Here is the fix:
standalone.xml
<datasources>
<!-- Start PostgresSQL datasource definitions using our deployed module -->
<datasource jta="false" jndi-name="java:/datasources/name" pool-name="pool-name" enabled="true" use-ccm="false">
<connection-url>url</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>postgresql</driver>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>false</prefill>
</pool>
<security>
<user-name>user</user-name>
<password>passwd</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<check-valid-connection-sql>SELECT current_timestamp</check-valid-connection-sql>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<!-- Add custom driver modules -->
<!--Example: <driver name="postgresql-jdbc4" module="org.postgresql"/> -->
<drivers>
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
<!-- End custom driver modules -->
<!--driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver-->
</drivers>
/modules/org/postgresql/main contents
module.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2010, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<module xmlns="urn:jboss:module:1.0" name="org.postgresql">
<resources>
<resource-root path="postgresql-9.1-902.jdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
postgresql-9.1.902.jdbc4.jar.index
org/postgresql/jdbc2
org/postgresql/jdbc3g
org/postgresql/ds/jdbc4
org/postgresql/ssl
org/postgresql/xa
org/postgresql/jdbc2/optional
org
org/postgresql/jdbc4
org/postgresql/ds
org/postgresql/jdbc3
org/postgresql/copy
org/postgresql/util
org/postgresql/gss
org/postgresql/translation
org/postgresql
org/postgresql/ds/jdbc23
META-INF
org/postgresql/core/types
org/postgresql/geometric
org/postgresql/core
org/postgresql/core/v2
org/postgresql/ds/common
org/postgresql/core/v3
META-INF/services
org/postgresql/largeobject
org/postgresql/fastpath
Postgresql JDBC4 driver from:
http://jdbc.postgresql.org/download/postgresql-9.1-902.jdbc4.jar
Tested and working. If you are sure to include this:
enabled="true"
in your config.xml definition you wont have to enable the driver manually after the AS server starts.