Last modified by Ken McWilliams on 2012/03/15 21:23

From version Icon 2.1 Icon
edited by Ken McWilliams
on 2012/03/15 22:15
Change comment: There is no comment for this version
To version Icon 2.2 Icon
edited by Ken McWilliams
on 2012/03/15 22:21
Change comment: There is no comment for this version

Summary

Details

Icon Page properties
Content
... ... @@ -1,35 +1,46 @@
1 -Using Glassfish 3.1.2.1 and MySQL actually MariaDB ver 5.3.2 but it will not make a difference in configuration.
2 -\\Install the MySQL Driver for Glassfish
3 -1) Download the latest mysql java driver (at time of writing 5.1.18): http:~/~/dev.mysql.com/downloads/connector/j/
4 -2) Extract the contents and locate mysql-connector-java-x.x.x-bin.jar (where x.x.x is the current version)
5 -3) Copy this file to GLASSFISH_INSTALL_DIR/bin on my system this is: /home/ken/glassfish-3.1.2/glassfish/lib
6 -\\Starting in Netbeans 7.1.1
7 -1) Click on the Services tab -> Servers -> Right click "GlassFish Server 3.1.2.1" and select "Start"
8 -(NOTE: If the server was already running when the mysql connector jar was moved into the lib folder, restart glassfish now)
9 -2) Right click "GlassFish Server 3.1.2.1" and select "View Domain Admin Console"
10 -\\In the domain console:
11 -\\Resources -> JDBC -> JDBC Connection Pools -> Click "New..."
1 +Using Glassfish 3.1.2.1 and MySQL actually MariaDB ver 5.3.2 but it will not make a difference in configuration.\\
2 +
3 +== Install the MySQL Driver for Glassfish ==
4 +
5 +1. Download the latest mysql java driver (at time of writing 5.1.18): http:~/~/dev.mysql.com/downloads/connector/j/
6 +1. Extract the contents and locate mysql-connector-java-x.x.x-bin.jar (where x.x.x is the current version)
7 +1. Copy this file to GLASSFISH_INSTALL_DIR/bin on my system this is: /home/ken/glassfish-3.1.2/glassfish/lib\\
8 +
9 +==
10 +Configuration Starting in Netbeans 7.1.1 ==
11 +
12 +1. Click on the Services tab -> Servers -> Right click "GlassFish Server 3.1.2.1" and select "Start" (**NOTE**: If the server was already running when the mysql connector jar was moved into the lib folder, restart glassfish now)
13 +1. Right click "GlassFish Server 3.1.2.1" and select "View Domain Admin Console"\\
14 +
15 +==
16 +Glassfish domain console
17 + ==
18 +
19 +Resources -> JDBC -> JDBC Connection Pools -> Click "New..."
12 12  \\Enter the following values
13 -Pool Name = Name for your pool (ie: Gallery)
14 -Resource Type = javax.sql.ConnectionPoolDataSource
15 -Database Driver Vendor = MySql
16 -Introspect = Leave this unchecked
17 -\\Click Next.
21 +**Pool Name** = Name for your pool (ie: Gallery)
22 +**Resource Type** = javax.sql.ConnectionPoolDataSource
23 +**Database Driver Vendor** = MySql
24 +**Introspect** = Leave this unchecked
25 +\\Click **Next**.
18 18  \\The defaults should be fine to start with, however we need to add some additional properties to make the connection.
19 19  \\Scroll down the the "Additional Properties" table.
20 20  \\Locate and set the following properties:
21 -\\User = name of mysql user who will access the database (ie: root)
22 -DatabaseName = name of mysql database/schema (ie: gallery)
23 -Password = password mysql requires for the above user (ie: password)
24 -URL = jdbc:mysql:~/~/localhost:3306/database_name (ie: jdbc:mysql:~/~/:3306/gallery)
25 -Url = jdbc:mysql:~/~/localhost:3306/database_name (Yes we really need to enter this string twice)
26 -ServerName = localhost
29 +\\**User** = name of mysql user who will access the database (ie: root)
30 +**DatabaseName** = name of mysql database/schema (ie: gallery)
31 +**Password** = password mysql requires for the above user (ie: password)
32 +**URL** = jdbc:mysql:~/~/localhost:3306/database_name (ie: jdbc:mysql:~/~/:3306/gallery)
33 +**Url** = jdbc:mysql:~/~/localhost:3306/database_name (Yes we really need to enter this string twice)
34 +**ServerName** = localhost
27 27  \\Click Finish
28 28  \\Under the General tab, test the connection with "Ping" if we see "Ping Succeeded" we are good so far, if not check values
29 -we just entered.
30 -\\Next we create a JNDI name for the connection pool which we can use to access the connection pool from our application.
31 -\\Resources -> JDBC -> JDBC Resources -> click "New..."
32 -\\JNDI Name = (what you want to call the pool, ie: jdbc/gallery )
33 -Pool Name = (Select the pool we just created from the drop down)
34 -Description = (Optional, ie: "Connection to the Gallery Database")
35 -\\Click "OK" and you are ready to use the connection pool in your application (Hiberbate/Spring)
37 +we just entered.\\
38 +
39 +=== Create a JNDI name for the connection pool
40 + ===
41 +
42 +Resources -> JDBC -> JDBC Resources -> click "New..."
43 +\\**JNDI Name** = (what you want to call the pool, ie: jdbc/gallery )
44 +**Pool Name** = (Select the pool we just created from the drop down)
45 +**Description** = (Optional, ie: "Connection to the Gallery Database")
46 +\\Click "OK" and you are ready to use the connection pool via the JNDI name in your application via JPA/Spring.