Wildfly and PostgreSQL

How to add Postgresql driver to Wildfly / JBoss Application Server

https://jdbc.postgresql.org/download/postgresql-42.2.10.jar

$ ./jboss-cli.sh

module add \
 --name=org.postgresql \
 --resources=~/Downloads/postgresql-42.2.10.jar \
 --dependencies=javax.api,javax.transaction.api

 /subsystem=datasources/jdbc-driver=postgresql:add( \
 driver-name="postgresql", \
 driver-module-name="org.postgresql", \
 driver-class-name=org.postgresql.Driver, \
 driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource
data-source add \
 --name=testds \
 --driver-name=postgresql \
 --jta=true \
 --jndi-name=java:jboss/datasources/testds \
 --connection-url=jdbc:postgresql://localhost:5432/testdb \
 --user-name=postgres \
 --password=postgres