-
Notifications
You must be signed in to change notification settings - Fork 115
How to Configure MySQL Database for HMIS
This guide explains how to configure the MySQL database for the HMIS application. It includes steps for setting up the MySQL JDBC Driver, configuring a JDBC connection pool, and creating a JDBC resource in the Payara server.
Ensure that you have the following:
- MySQL Server installed and running
- Payara Server installed and running
- MySQL JDBC Driver (
mysql-connector-java-version-bin.jar)
- Copy the
mysql-connector-java-version-bin.jarfile into thelibdirectory of your Payara server.
cp /path/to/mysql-connector-java-version-bin.jar /path/to/payara/glassfish/domains/domain1/lib/
-
Replace
/path/to/mysql-connector-java-version-bin.jarwith the path to your MySQL JDBC Driver, and/path/to/payara/with the path to your Payara installation. -
Restart the Payara server to load the new JDBC driver.
/path/to/payara/bin/asadmin stop-domain
/path/to/payara/bin/asadmin start-domain
-
In the Payara admin console (typically
http://localhost:4848), navigate toResources > JDBC > JDBC Connection Pools. -
Click
New...to create a new connection pool. -
Enter the following details:
- Pool Name: Enter the name of your connection pool (for example,
HMISPool). - Resource Type: Select
javax.sql.DataSource. - Database Driver Vendor: Select
MySQL.
- Pool Name: Enter the name of your connection pool (for example,
-
Click
Next. -
In the
Additional Propertiessection, enter the following:- ServerName: Enter the hostname of your MySQL server (for example,
localhost). - DatabaseName: Enter the name of your database.
- User: Enter your MySQL username.
- Password: Enter your MySQL password.
- URL: Enter your JDBC URL. This should look something like
jdbc:mysql://localhost:3306/your_database?useSSL=false&allowPublicKeyRetrieval=true. Replacelocalhostwith your MySQL server's hostname,3306with your MySQL server's port, andyour_databasewith the name of your database.
- ServerName: Enter the hostname of your MySQL server (for example,
-
Click
Finishto create the connection pool.
-
In the Payara admin console, navigate to
Resources > JDBC > JDBC Resources. -
Click
New...to create a new JDBC resource. -
Enter the JNDI Name as specified in your
persistence.xmlfile (for example,jdbc/HMIS) and select the Pool Name as created in the previous step (HMISPool). -
Click
OKto create the JDBC resource.
Your Payara server is now configured to use your MySQL database. You should be able to deploy and run your HMIS application.