GlassFish and MySQL bundle was released a while ago and I finally got a chance to try it out. Here are simple instructions to get you started:
- Download GlassFish and MySQL co-bundle zip from here.
- Install the bundle (detailed docs)
- Create a temp directory and unzip the contents of bundle there. The contents are:
-rw-r–r– 1 arungupta arungupta 239703 Mar 19 02:57 3RD-PARTY-LICENSE.txt
-rw-r–r– 1 arungupta arungupta 709 Mar 19 02:57 LICENSE.txt
-rw-r–r– 1 arungupta arungupta 1560195 Mar 19 02:57 appserv.class
drwxr-xr-x 18 arungupta arungupta 612 Mar 19 02:57 package
-rwxr-xr-x 1 arungupta arungupta 5577 Mar 19 02:57 setup - Invoke “setup” script that brings up the installer. Take the default value, click “Next”, accept the license, click “Next” and specify the install directory location as shown below:

- If the directory is not created, then click on “Create Directory” button. Enter the administrator password and click on “Don’t Prompt for Admin User Name and Password” as shown below:

These are not the typical values used in a production system.
- Take the default values for MySQL as shown below:

and click on “Next”.
- Once the final options are shown, click on “Install Now” button to start the install process:

and see the install in progress as shown below:

- It’s recommended to Regiser the recently installed copy of Application Server, the benefits are highlighted here. After registration, click on “Next” and then on “Finish” to complete the installation process.
- The directory structure after completed installation looks like:
drwxr-xr-x 22 arungupta arungupta 748 Aug 10 16:23 .
drwxr-xr-x 5 arungupta arungupta 170 Aug 10 16:22 ..
-rw-r–r– 1 arungupta arungupta 239703 Aug 10 16:23 3RD-PARTY-LICENSE.txt
-rw-r–r– 1 arungupta arungupta 4149 Aug 10 16:23 COPYRIGHT
-rw-r–r– 1 arungupta arungupta 2126 Aug 10 16:23 Install_Application_Server_9PE_200808101622.log
-rw-r–r– 1 arungupta arungupta 709 Aug 10 16:23 LICENSE.txt
-rw-r–r– 1 arungupta arungupta 20025392 Aug 10 16:23 License_Notice_Translated.pdf
-rw-r–r– 1 arungupta arungupta 186 Aug 10 16:23 Sun_Java_System_Application_Server_install.A08100423
-rw-r–r– 1 arungupta arungupta 191191 Aug 10 16:23 Sun_Java_System_Application_Server_install.B08100423
-rw-r–r– 1 arungupta arungupta 1569911 Aug 10 16:23 appserv_uninstall.class
drwxr-xr-x 17 arungupta arungupta 578 Aug 10 16:23 bin
drwxr-xr-x 4 arungupta arungupta 136 Aug 10 16:23 config
drwxr-xr-x 9 arungupta arungupta 306 Aug 10 16:23 docs
drwxr-xr-x 3 arungupta arungupta 102 Aug 10 16:23 domains
drwxr-xr-x 11 arungupta arungupta 374 Aug 10 16:23 imq
drwxr-xr-x 9 arungupta arungupta 306 Aug 10 16:23 javadb
drwxr-xr-x 14 arungupta arungupta 476 Aug 10 16:23 jbi
drwxr-xr-x 65 arungupta arungupta 2210 Aug 10 16:23 lib
drwxr-xr-x 19 arungupta arungupta 646 Aug 10 16:23 mysql
drwxr-xr-x 6 arungupta arungupta 204 Aug 10 16:23 samples
-rwxr-xr-x 1 arungupta arungupta 4717 Aug 10 16:23 uninstall
tyle="font-family: monospace;"> drwxr-xr-x 14 arungupta arungupta 476 Aug 10 16:23 updatecenter - Configure MySQL
- In “mysql” directory, change the permissions of “configure” and “scripts/mysql_install_db” script by invoking
chmod +x configure scripts/mysql_install_db - Then invoke “configure” script to see the output as:
~/tools/glassfish/v2/SUNWappserver/mysql >./configure
NOTE: This is a MySQL binary distribution. It’s ready to run, you don’t
need to configure it!To help you a bit, I am now going to create the needed MySQL databases
and start the MySQL server for you. If you run into any trouble, please
consult the MySQL manual, that you can find in the Docs directory.Installing MySQL system tables…
080810 16:39:16 [Warning] Setting lower_case_table_names=2 because file system for /Users/arungupta/tools/glassfish/v2/SUNWappserver/mysql/data/ is case insensitive
OK
Filling help tables…
080810 16:39:16 [Warning] Setting lower_case_table_names=2 because file system for /Users/arungupta/tools/glassfish/v2/SUNWappserver/mysql/data/ is case insensitive
OKTo start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password ‘new-password’
./bin/mysqladmin -u root -h Macintosh-187.local password ‘new-password’Alternatively you can run:
./bin/mysql_secure_installationwhich will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.plPlease report any problems with the ./bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
Starting the mysqld server. You can test that it is up and running
with the command:
./bin/mysqladmin version
~/tools/glassfish/v2/SUNWappserver/mysql >chown: /Users/arungupta/tools/glassfish/v2/SUNWappserver/mysql/data/Macintosh-187.local.err: Operation not permitted
Starting mysqld daemon with databases from /Users/arungupta/tools/glassfish/v2/SUNWappserver/mysql/dataThis configures and starts MySQL process as well. As mentioned in the command output, MySQL server running can be cofirmed by giving the command “./bin/mysqladmin version”. It shows the following output on my machine:
~/tools/glassfish/v2/SUNWappserver/mysql >./bin/mysqladmin version
./bin/mysqladmin Ver 8.41 Distrib 5.0.51a, for apple-darwin8.6.0 on powerpc
Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL licenseServer version 5.0.51a
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 2 min 22 secThreads: 1 Questions: 1 Slow queries: 0 Opens: 12 Flush tables: 1 Open tables: 6 Queries per second avg: 0.007
MySQL daemon can always be restarted as:
~/tools/glassfish/v2/SUNWappserver/mysql >./bin/mysqld_safe
Starting mysqld daemon with databases from /Users/arungupta/tools/glassfish/v2/SUNWappserver/mysql/data - Register GlassFish and MySQL with NetBeans
- Installing GlassFish is straight-forward – Just go to NetBeans IDE, “Services” tab, “Services” tree, right-click and select “Add Server…” as shown:

and then follow the directions.
- To configure MySQL, right-click on “Databases” tree and select “Register MySQL Server …” as shown (official docs):
- Take the default values in “Basic Properties” and specify the properties in “Admin Properties” tab as:

- Starting MySQL server from the command gives “Permission Denied” access. So I started MySQL server from command-line as shown above and then could see all the databases as shown below:

Alternatively, you can also download NetBeans 6.1 with GlassFish and MySQL Bundle where both GlassFish and MySQL are pre-configured for you.
Now you can leverage this deadly combination of NetBeans, GlassFish and MySQL to create any enterprise application.
There are many related blog entries on this topic as well:
- GlassFish bundle with MySQL Community Server
- New NetBeans 6.1, GlassFish, & MySQL Bundle
- NetBeans 6.1 with GlassFish, MySQL bundle
- Sun AppServer (GlassFish) / MySQL bundle now available
Technorati: glassfish mysql netbeans
Related posts:- TOTD #99: Creating a Java EE 6 application using MySQL, JPA 2.0 and Servlet 3.0 with GlassFish Tools Bundle for Eclipse
- TOTD #60: Configure MySQL 6.0.x-alpha to NetBeans 6.5
- LOTD #20: How to create a JPA application using GlassFish Tools Bundle for Eclipse ?
- TOTD #98: Create a Metro JAX-WS Web service using GlassFish Tools Bundle for Eclipse
- GlassFish Tools Bundle for Eclipse now available
Hi arun. You may want to also add Alexis [1] entry to your list
[1]http://blogs.sun.com/alexismp/entry/sun_appserver_glassfish_mysql_bundle
Comment by Eduardo Pelegri-Llopart — August 11, 2008 @ 8:31 am
Hi, Arun. The permission denied problem in NetBeans can be worked around by making the "Path to start command" be the full path to gksu, whatever it is on your system, and then make the "Arguments" be the path to mysqld_safe.
Also, FYI, the next bundle of MySQL with NetBeans will come with the start and stop commands preconfigured.
Comment by David Van Couvering — August 11, 2008 @ 9:53 am
Eduardo, thanks for the pointer, now added!
Comment by Arun Gupta — August 11, 2008 @ 10:55 am
David, I entered the path to sudo and mysqld_safe in arguments. But that shows "Password:" prompt in output console and not taking inputs. How do I enter the sudo password ?
Comment by Arun Gupta — August 11, 2008 @ 10:58 am