0% found this document useful (0 votes)
61 views3 pages

Creating DS Payara

This document provides steps to create and set up a MySQL datasource in Payara: 1. Unzip the MySQL JDBC driver and copy it to the Payara lib folder. 2. Access the Payara admin console, go to the JDBC menu, and create a new connection pool using the MySQL driver. 3. Configure the pool properties including the username, password, URL, and database name. 4. Create a new JDBC resource and associate it with the connection pool to make the pool available to applications.

Uploaded by

Ryan Blake
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views3 pages

Creating DS Payara

This document provides steps to create and set up a MySQL datasource in Payara: 1. Unzip the MySQL JDBC driver and copy it to the Payara lib folder. 2. Access the Payara admin console, go to the JDBC menu, and create a new connection pool using the MySQL driver. 3. Configure the pool properties including the username, password, URL, and database name. 4. Create a new JDBC resource and associate it with the connection pool to make the pool available to applications.

Uploaded by

Ryan Blake
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CREATING AND SETTING UP A MYSQL DATASOURCE IN PAYARA

1. Unzip the file containing the JDBC Driver


• Make sure the version of the driver matches the version of
your MySQL BD

2. Copy the file mysql-connector-java-x.x.x-bin.jar in the folder of the


Payara installation:
• /payara/glassfish/lib
• /payara/glassfish/domains/nombredominio/lib

3. Start the Payara from Eclipse


4. From the server Windows right-click on the Glassfish server and
open the administrator console
• Use the Chrome browser if necessary to access the console
(http://localhost:4848/)
• User: admin
• Password: admin
5. From the main menu “Common Task” expand the menu
“Resources” and click on the entry “JDBC”
6. Click on ‘Connection Pools’ to display the page of the connection
pools.

7. Click on “New”
8. Type a name for the new JDBC connection pool. Select javax.sql.
DataSource as ‘Resource Type’ and MySQL as ‘Database vendor’.
9. In the field ‘DataSource ClassName’ write as an alternative to the
default displayed by default:
com.mysql.cj.jdbc.MysqlConnectionPoolDataSource.

10. In “Properties” add the following ones. Remember to change the


password and the name of the database to match yours in the
properties “password”, “url” and “databaseName”, respectively

11.Click “Finish” to go back to the connection pools page


12.Click on the pool you just created to go to the page ‘Edit Connection
Pool’.
13.Click on “Ping” to check that the connection has been set up
correctly

14.Now go to the menu “JDBC Resources” in the “JDBC” menu


15.Click on “New”
16.Type the JNDI name for the new DataSource. In the field “Pool
Name” select the pool you just created

17.Click OK to finish

Now you can obtain a connection with the DataSource using this code
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
. . .
public Class . . .
@Resource (mappedName=”TIWDS”)
DataSource ds;

You might also like