-
Notifications
You must be signed in to change notification settings - Fork 0
/
set-up-postgresql-with-wildfly-instructions.txt
55 lines (34 loc) · 2.33 KB
/
set-up-postgresql-with-wildfly-instructions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Instructions on setting up the PostgreSQL database with the WildFly application server
===========================================================================================================
----------------------------------------------
Connect to the WildFly command line interface (CLI).
----------------------------------------------
1. Start the WildFly application server.
2. Connect to the WildFly command line interface (CLI) by running the following commands (Note: $JBOSS_HOME must be
defined as the path to the installation directory of WildFly):
$JBOSS_HOME/bin/jboss-cli.sh
3. Run "connect" and log in.
----------------------------------------------
Install the PostgreSQL JDBC driver.
----------------------------------------------
Note: These steps are not needed if the driver is provided in an application's jar path.
1. Go to "https://jdbc.postgresql.org/download.html" and download the lastest jar.
Note: Some of the remaining commands in this document contain content sections ("<content>") that must to be replaced
respectively.
2. Install the driver by running the following command in the CLI:
module add --name=org.postgresql --slot=main --resources=<path/to/jar> \
--dependencies=javax.api,javax.transaction.api
3. Start the server and check if the installation was successful.
If the installation failed with an error stating that the postgresql jdbc module was not found, a possible solution
may be to use a different jdbc driver (e.g. "postgresql-9.4-1201.jdbc41.jar").
----------------------------------------------
(Optional) Add PostgreSQL as a JDBC datasource.
----------------------------------------------
Note: WildFly datasources can also be defined in an application's WildFly persistence.xml file.
1. Optionally set up PostgreSQL as a datasource by running the following two commands in the CLI:
/subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",\
driver-module-name="org.postgresql",driver-class-name=org.postgresql.Driver)
data-source add --name=PostgresDS \
--connection-url=jdbc:postgresql://127.0.0.1:<postgresql_port>/<postgresql_database> \
--driver-name=postgres --jndi-name=java:jboss/datasources/PostgresDS \
--user-name=<postgresql_username> --initial-pool-size=2 --max-pool-size=10 --query-timeout=5