Configuring datasources in GlassFish

In Chapter 4, Creating JEE Database Applications, we created the JDBC datasource locally in the application. In this chapter, we will create a JDBC datasource in GlassFish. GlassFish Server is not packaged with the JDBC driver for MySQL. So, we need to place the .jar file for MySQLDriver in the path where GlassFish can find it. You can place such external libraries in the lib/ext folder of the GlassFish domain in which you want to deploy your application. For this example, we will copy the JAR in <glassfish_home>/glassfish/domains/domain1/lib/ext.

If you do not have the MySQL JDBC driver, you can download it from http://dev.mysql.com/downloads/connector/j/:

  1. Open the GlassFish admin console, either by ...

Get Java EE 8 Development with Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.