Create a postgres datasource using jboss CLI:
Create a file called my-script.cli
contents of my-script.cli file:
embed-server
/system-property=my.config.property:add(value="dev")
module add --name=org.postgresql --resources=~/Downloads/postgresql-9.4-1203.jdbc42.jar --dependencies=javax.api,javax.transaction.api
batch
/subsystem=datasources/jdbc-driver=org.postgresql:add(driver-name=org.postgresql, driver-module-name=org.postgresql, driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)
/subsystem=datasources/data-source=postgresql:add(driver-name=org.postgresql, jndi-name="java:/jdbc/PostgresDS", enabled=true, connection-url="jdbc:postgresql://localhost/test")
run-batch
stop-embedded-server
Then you'd just run it like
$JBOSS_HOME/bin/jboss-cli.sh --file=my-script.cli
No comments:
Post a Comment