It's as easy as pie.
- start Payara
$ cd ~/payara5/bin
$ ./asadmin start-domain
Waiting for domain1 to start ...............
Successfully started the domain : domain1
domain Location: /home/mrbear/payara5/glassfish/domains/domain1
Log File: /home/mrbear/payara5/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully. - install the database driver
$ ./asadmin add-library /home/mrbear/software/mariadb-java-client-2.3.0.jaror try:
Command add-library executed successfully.
$ cp ~/Downloads/mariadb-java-client-2.3.0.jar ~/payara5/glassfish/domains/domain1/libThe last part will probably require a payara application server reboot, though.
- connect to http://localhost:4848
- surf to Resources -> JDBC -> JDBC Connection Pools
- Create a new one
- Settings:
Pool name [obvious] Resource Type javax.sql.DataSource Datasource classname org.mariadb.jdbc.MariaDbDataSource Leave the rest as default.
- Define the following additional properties:
Name Value serverName localhost URL jdbc:mariadb://localhost:3306/mmud databaseName mmud user username password itsasecret - Try the "Ping" button to verify that the connection is established.
- surf to Resources -> JDBC -> JDBC Resources
- Create a new one
- Settings:
Name Value JNDI Name this is the name as the resource is defined in your application Pool Name the pool defined previously, it's a dropdown which is convenient. - Press finish or OK or something
- Done!
References
- Using MySQL with Payara Server
- https://blog.payara.fish/using-mysql-with-payara
- Payara - Using Hibernate 5 on Payara Server
- https://blog.payara.fish/using-hibernate-5-on-payara-server
No comments:
Post a Comment