The Source for Java Technology Collaboration
User: Password:



Sreenivas Munnangi's Blog

Sreenivas Munnangi Sreenivas Munnangi is a senior member of the Sun Java Application Server Administration and Management team. He is also the java.net project owner for glassfish-samples project. He was a key contributor to the Application Server Enterprise Edition design and implementation. His earlier experience was in the areas of eCommerce applications, web applications, and N-tier application architecture.



Java EE 5 samples integarte well with mysql database

Posted by msreddy on March 28, 2008 at 10:02 AM | Permalink | Comments (2)

As part of bundling mysql with GlassFish application server, I set out to test one of the existing samples on mysql which so far used the default Java DB database. It was easy and here are the steps.

  • Install the application server out of the bundle which includes MySQL.
  • Start MySQL DB.
    Refer this install guide for information on how to start MySQL server.
  • login to MySQL data base as root
    grant all privileges on *.* to 'dbuser'@'localhost' identified by 'dbpassword';
    One can be more specific while granting privileges to restrict the scope of access. In addition, the values used for user 'dbuser' and password 'dbpassword' are suggestive, you are free to change them but make sure they are referred appropriately in jdbc connection pool.
  • Start the application server and connect to it through a browser at admin port 4848.
    create jdbc connection pool using the node Resources/JDBC/Connection Pools

    Name: mysqlPool Resource Type: javax.sql.DataSource Database Vendor: mysql

    click on next and define the following properties

    databaseName: test user: dbuser password: dbpassword Url: jdbc:mysql://localhost:3306/test URL: jdbc:mysql://localhost:3306/test

    The default port for MySQL is 3306. If it is different, replace the port 3306 with the correct port number.

  • Crate jdbc resource using the node Resources/JDBC/JDBC Resources

    JNDI Name: jdbc/mysql Pool Name: mysqlPool

  • Deploy the attached war file jsf-jpa-war.war whose ./src/conf/persistence.xml uses jdbc/mysql
    For more information on the jsf-jpa-war sample, please refer to sample documentation.

    This is a part of the Java EE 5 samples bundle which can be downloaded from https://glassfish-samples.dev.java.net/

  • Verify the working of deployed war by connecting to localhost:8080/jsf-jpa-war

June 2008
Sun Mon Tue Wed Thu Fri Sat
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          


Search this blog:
  

Categories
Community: Java Enterprise
Archives

March 2008
January 2008
May 2007

Recent Entries

Java EE 5 samples integarte well with mysql database

GlassFish V2 UR1 extends support for AIX Platform

GlassFish V2 Hands On Lab at JavaOne



Powered by
Movable Type 3.01D


 Feed java.net RSS Feeds