Skip to content

Instantly share code, notes, and snippets.

@safarcik
Forked from TFaga/driver.sh
Created August 2, 2018 06:25
Show Gist options
  • Save safarcik/6b0b8d7277d5a342ca0af9e14a0a07f4 to your computer and use it in GitHub Desktop.
Save safarcik/6b0b8d7277d5a342ca0af9e14a0a07f4 to your computer and use it in GitHub Desktop.
Wildfly postgresql datasource configuration
./jboss-cli.sh
embed-server --std-out=echo --server-config=standalone.xml
module add --name=org.postgres --resources=/tmp/postgresql-42.1.1.jar --dependencies=javax.api,javax.transaction.api
exit
<subsystem xmlns="urn:jboss:domain:datasources:4.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/PostgresDS" pool-name="PostgresDS" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://localhost:5432/postgres</connection-url>
<driver>postgres</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<xa-datasource jndi-name="java:jboss/PostgresXADS" pool-name="PostgresXADS">
<driver>postgres</driver>
<xa-datasource-property name="ServerName">localhost</xa-datasource-property>
<xa-datasource-property name="PortNumber">5432</xa-datasource-property>
<xa-datasource-property name="DatabaseName">postgres</xa-datasource-property>
<security>
<user-name>postgres</user-name>
<password>postgres</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker">
</valid-connection-checker>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter">
</exception-sorter>
</validation>
</xa-datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="postgres" module="org.postgres">
<driver-class>org.postgresql.Driver</driver-class>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment