Create MySQL jdbc Connection Pool from Glassfish Admin GUI




To create a mySQL dbc connection pool from Glassfish V2 Admin GUI console, please follow 2 steps below
    1. Create a new mysql test account
    2. Create jdbc connection pool

1. Create a new mysql user account
    a. Start database from a command prompt
        $../<GlassFish-Installed>/mysql/bin/mysqld-nt.exe --defaults-file=../<GlassFish-Installed>/mysql/mysql.ini
         (For Solaris machine replace mysqld-nt.exe by mysqld_safe)
    b. Login as database admin to create a testUser account
        $../<GlassFish-Installed>/mysql/bin/mysql -u root
         mysql> grant all privileges on \*.\* to 'testUser'@'localhost' identified by 'testPassword';
2. Create jdbc connection pool and test the connection
     a. Start domain1
        ../<GlassFish-Installed>bin/asadmin start-domain
     b. Create jdbc connection pool for mySQL
          -From Admin GUI Console > expand Resources node > JDBC > Connection Pools > click New button and enter information below:
                Name: testMYSQL
                Resources Type: javax.sql.DataSource
                Database Vendor: MySQL
            Click Next to proceed to the next panel
            Go to Additional Properties and enter:
                databaseName: test
                User: testUser
                Password: testPassword
                ServerName: localhost
           Click Finish button
           Click testMYSQL > select ping to test the connection




Comments:

I am having problems connecting to mySQL with Glassfish server. I did the suggestion on this web site (Create MySQL jdbc Connection Pool from Glassfish Admin GUI). the Ping was successful.

I downloaded the jdbc driver but i'm not sure which files to copy to the glassfish directory. I'm receiving error (Error trying to fetch data UserID/Password java.sql.SQLException)

Posted by Brenda on May 13, 2008 at 06:23 AM PDT #

Hi Brenda,

The file you need to download to glassfish/lib directory is "mysql-connector-java-5.1.6-bin.jar" from the url http://dev.mysql.com/downloads/connector/j/5.1.html.

Please let me know if it's working out for you.
-davis

Posted by Davis Nguyen on May 14, 2008 at 08:07 AM PDT #

Sorry, the url should be http://dev.mysql.com/downloads/connector/j/5.1.html (no . at the end)

Posted by Davis Nguyen on May 15, 2008 at 03:00 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

davisn

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today