Miles to go …

April 20, 2009

MySQL Users Conference 2009 Day 1 in Photos

Filed under: General — arungupta @ 9:16 pm

MySQL Users Conference started earlier this morning with tutorials. I attended MySQL Cluster Tutorial and part of Scale-Up, Scale-Out, and High Availability: Solutions and Combinations. Both of them were very involving with practical real-life advice.

Here are tweets from the morning of MySQL Cluster Tutorial:





And now the tweets from “Scale-Up, Scale-Out, and High Availability: Solutions and Combinations” session:

Here are some pictures captured during the day:

And tomorrow I present on Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans.

And then the evolving picture album is available at:

Come meet us at the GlassFish booth in the Exhibit Floor.

Technorati: conf mysqlconf santaclara glassfish netbeans

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

GlassFish in Twitterverse – Oracle buying Sun

Filed under: General — arungupta @ 1:07 pm

Oracle has entered a definitive agreement to acquire Sun for $9.50 per share in cash. Read more details in Sun’s PR and Oracle’s PR.

Here are some tweets captured from the Twitterverse on GlassFish:

And there is certainly buzz at MySQL Users Conference about the announcement. Only time will tell the future and fate of this blog!

It seems there is only one other entry tagged Oracle on this blog ;-)

Technorati: glassfish twitter oracle sun

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 17, 2009

GlassFish and NetBeans at MySQL Users Conference 2009

Filed under: General — arungupta @ 4:00 am

What is open source, production-quality, supported by a large vibrant community, and comes with full enterprise support ? – GlassFish and MySQL.

Did you know that GlassFish …

  • is the only open-source Java EE 5 compliant Application Server
  • can be used to deploy Rails, Grails, and Django applications
  • has 13x better price/performance than Dell/HP, and therefore a much lower TCO
  • has an easy-to-use and intuitive web-based administration console
  • has enterprise features like clustering/high availability, .NET-interoperable Web services, …

Are you attending MySQL Users Conference 2009 and interested to learn how GlassFish and MySQL together provides an ideal deployment platform for all your web applications ?

There are several other advantages which I’ll be speaking on Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans and the coordinates are:

When: April 21, 2009 (Tuesday), 3:05 pm
Where: Ballroom A

You can also find us on the Exhibitor Floor!

Technorati: conf glassfish netbeans mysql mysqlconf santaclara

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 10, 2009

Small Steps Foundation Walk 2009 – Help Under Privileged Children by Walking

Filed under: Running — arungupta @ 4:00 am

Did you know walking can help underprivileged children ? Read on …

Small Steps Foundation is a 501c3 non-profit organization that helps under privileged children by raising funds in the US.  They are organizing a 5K/10K walk on May 17th, 10am at Coyote Hills Regional Park.

I’m walking 10K along with my family and so are bunch of my family members and friends. There are multiple ways you can participate in this cause:

  • Register now for a 5K/10K walk
  • Donate, any amount, even $5 is good. Help us reach our goal of $500.
  • Forward this to your friends who live in the neighborhood and interested in participating

When: May 17th, 10am
Where: Coyote Hills Regional Park
What: 5K/10K walk

Small Steps is a 501c3 non-profit organization so all your contributions are tax deductible. Read about their involvement with different organizations to fulfill this noble cause. It involves formal schooling to children from neighboring slum clusters, computers for about 300 children in a local village, and education to the children of migrant project workers.

If not us, then who ? If not now, then when ?

Donate/Walk a few miles for a million smiles …

And remember your company may be giving matching $$$ so that doubles the effect!

Technorati: running walk charity smallsteps children

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 9, 2009

LOTD #20: How to create a JPA application using GlassFish Tools Bundle for Eclipse ?

Filed under: General — arungupta @ 11:30 am

Here is a great screencast (from the community) that shows how to create a JPA application using EclipseLink and deploy on GlassFish v2.1 – all using GlassFish Tools Bundle for Eclipse.

Click on the image below for the video:

Thanks!

I’ll work on a MySQL version of it :)

All previous links in this series are archived at LOTD.

Technorati: lotd glassfish eclipse jpa javadb screencast

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 8, 2009

TOTD #78: GlassFish, EclipseLink, and MySQL efficient pagination using LIMIT

Filed under: web2.0 — arungupta @ 4:00 am

EclipseLink JPA replaces TopLink Essentials as the JPA implementation in GlassFish v3. One of the benefits of using EclipseLink is that it provides efficient pagination support for the MySQL database by generating native SQL statements such as “SELECT … FROM <table> LIMIT <offset>, <rowcount>”.

The MySQL LIMIT clause definition says:

The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be non-negative integer constants (except when using prepared statements).

With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1):

SELECT * FROM tbl LIMIT 5,10;  # Retrieve rows 6-15

So instead of fetching all rows from the database and then filtering from row 6-15, only rows 6 through 15 are fetched.

This TOTD (Tip Of The Day) explains how to create a JPA Persistence Unit for sakila (MySQL sample database) using NetBeans, use EclipseLink as the Persistence Provider, and then write a JPA query to leverage the pagination support – all on GlassFish v3.

  1. Create a Persistence Unit for “sakila” as explained in this blog using bullets #1 – 3. The differences are explained below:
    1. In 2.1, choose “GlassFish v3 Prelude” as the server. Even though “GlassFish v3 Prelude” is chosen as the server but it will be replaced with a recent promoted build because pagination feature is not implemented in the Prelude. Alternatively you can use NetBeans 6.7 M3 and GlassFish v3 as explained here.
    2. In 3.3, EclipseLink is shown as the default Persistence Provider as shown below:

    3. In 3.5, there is no need to specify the properties for “user” and “password as the JDBC resource is stored in the server configuration. Instead specify the following property:
      <properties>
          <property name=”eclipselink.logging.level” value=”FINE”/>
      </properties>

      This will log any SQL statement sent by JPA to the underlying persistence provider (EclipseLink in this case).

  2. If GlassFish v3 was configured using NetBeans 6.7 M3, then the JDBC Connection Pool and JDBC resource were created in the server directly. If not, then download and unzip the latest GlassFish v3 latest promoted build (b43 as of this writing). Create the JDBC Connection Pool as:
    ./asadmin create-jdbc-connection-pool –datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource –property user=duke:password=glassfish:ServerName=localhost:portNumber=3306:databaseName=sakila jdbc-mysql-pool

    and the JDBC resource:

    ./asadmin create-jdbc-resource –connectionpoolid jdbc-mysql-pool jndi/sakila

    GlassFish v3 b43 bundles ”Eclipse Persistence Services – 2.0.0.r3652-M1″. A later blog will explain how to replace the bundled EclipseLink version with a newer/different EclipseLink version.

  3. Create a new Servlet “QueryServlet”. Inject the javax.persistence.EntityManagerFactory resource:
        @PersistenceUnit
        EntityManagerFactory emf;

    and change the “processRequest” operation to:

            EntityManager em = emf.createEntityManager();

            response.setContentType(“text/html;charset=UTF-8″);
            PrintWriter out = response.getWriter();
            try {
                int startRow = Integer.valueOf(request.getParameter(“start_row”));
                int howMany = Integer.valueOf(request.getParameter(“how_many”));
                Query q = em.createNamedQuery(“Film.findAll”);

                q.setFirstResult(startRow);
                q.setMaxResults(startRow + howMany);
                for (Object film : q.getResultList()) {
                    out.print(((Film)film).toString() + “<br/>”);
                }
            } finally {
                out.close();
            }

    This Servlet reads two parameters from the request and sets parameters on the JPA Query to enable pagination.

  4. Deploy the application on GlassFish v3.
    1. Using NetBeans 6.7 M3, select “Deploy” from the context-sensitive menu.
    2. Using NetBeans 6.5.1, select “Clean and Build” and then manually deploy the WAR file using “asadmin deploy dist/Pagination.war”.

If the project name was “Pagination”, then the Servlet is accessible at “http://localhost:8080/Pagination/QueryServlet?start_row=1&how_many=10″ and shows ten rows starting at index “1″. The output looks like:

The log file in “domains/domain1/logs/server.log” show the following SQL query generated by EclipseLink:

[#|2009-04-07T14:01:12.815-0700|FINE|glassfish|org.eclipse.persistence.session.file: /Users/arungupta/tools/glassfish/v3/b43/glassfishv3/glassfish/domains/domain1/applications/Pagination/WEB-INF/classes/-PaginationPU.sql| _ThreadID=15;_ThreadName=Thread-1;ClassName=null;MethodName=null;|SELECT film_id AS film_id1, special_features AS special_features2, last_update AS last_update3, rental_duration AS rental_duration4, release_year AS release_year5, title AS title6, description AS description7, replacement_cost AS replacement_cost8, length AS length9, rating AS rating10, rental_rate AS rental_rate11, language_id AS language_id12, original_language_id AS original_language_id13 FROM film LIMIT ?, ?
        bind => [1, 11]|#]

As you can see, the query uses the LIMIT clause which optimizes the data returned from the table.

If a different database, for example Derby, is used then the generated SQL query looks like as:

[#|2009-04-07T17:00:34.210-0700|FINE|glassfish|org.eclipse.persistence.session.file: /Users/arungupta/tools/glassfish/v3/b43/glassfishv3/glassfish/domains/domain1/applications/Pagination/WEB-INF/classes/-PaginationPU.sql| _ThreadID=15;_ThreadName=Thread-1;ClassName=null;MethodName=null;|SELECT film_id, special_features, last_update, rental_duration, release_year, title, description, replacement_cost, length, rating, rental_rate, language_id, original_language_id FROM film|#]

In this case, the entire table is fetched and the rows are filtered based upon the critieria specified on the client side.

If the number of rows is huge (a typical case for enterprise) then MySQL provides efficient fetching of records. And GlassFish v3, with EclipseLink JPA integrated, makes it much seamless for you.

Thanks to Mr GlassFish Persistence (aka Mitesh :) for helping me understand the inner workings.

Discuss this more at Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans technical session in the upcoming MySQL Users Conference!

Please leave suggestions on other TOTD (Tip Of The Day) that you’d like to see. A complete archive of all the tips is available here.

Technorati: totd glassfish v3 eclipselink jpa mysql

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 7, 2009

LOTD #19: Securing GlassFish Installation

Filed under: General — arungupta @ 4:00 am

Found great (old) blogs (part 1, part 2) by Masoud Kalali that discusses the different ways to secure a GlassFish installation.

Changing master password and admin console passwords (both web-based and CLI) are two fairly trivial operations:

/tmp/glassfish >./bin/asadmin change-master-password
Please enter the new master password>changeit2
Please enter the new master password again>changeit2
Master password changed for domain domain1

and

/tmp/glassfish >./bin/asadmin change-admin-password
Please enter the old admin password>adminadmin
Please enter the new admin password>adminadmin2
Please enter the new admin password again>adminadmin2
Updated .asadminpass file with new password.
Command change-admin-password executed successfully.

And then the blog discusses how to secure administration listener using client-cert authentication or mutual authentication, reduce the visibility of listeners (as appropriate), and other similar techniques. Read Part 1 and Part 2.

The GlassFish Administration Guide provide more details on how to manage your GlassFish installation!

Technorati: glassfish administration security

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 6, 2009

GlassFish at San Francisco Java Users Group – May 12th, 2009

Filed under: General — arungupta @ 4:00 am

Are you living in the San Francisco Bay Area and like to hear all the craze around GlassFish ?

Jan Luehe (from the GlassFish Webtier team) and Roberto Chinnici (Java EE 6 specification lead) will be speaking on May 12th at the San Francisco JUG meetup. So get ready to drink from the firehose :)

There will be pizza, refreshments, book giveaways and other interesting goodies!

Click on the map below for directions:

Complete details about the event here, make sure to RSVP!

Technorati: conf glassfish jug sanfrancisco meetup

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 3, 2009

TOTD # 77: Running Seam examples with GlassFish

Filed under: General — arungupta @ 5:00 am
Seam is a full-stack solution to assemble complex web applications using simple annotated classes, a rich set of UI components, and very little XML. It integrates Ajax and Business Process Modeling with several Java EE technologies such as Java Server Faces (JSF), Java Persistence API (JPA), and Enterprise Java Beans (EJB 3.0).

GlassFish is a Java EE compliant application server so it’s natural to pick GlassFish as your deployment platform for Seam applications :)

This blog is going to show how Seam samples can be easily run on GlassFish.

  1. Download Seam 2.1.1 GA from here and unzip.
  2. Build “examples/jpa” sample as:
    ~/tools/jboss-seam-2.1.1.GA/examples/jpa >ant glassfish
    Buildfile: build.xml

    glassfish:

    initcopy:

    initpoms:
         [echo] Setting up dependencies
        [mkdir] Created dir: /Users/arungupta/tools/jboss-seam-2.1.1.GA/classes/poms
         [copy] Copying 1 file to /Users/arungupta/tools/jboss-seam-2.1.1.GA/classes/poms
    [artifact:install] [INFO] Installing /Users/arungupta/tools/jboss-seam-2.1.1.GA/classes/poms/root.pom to . . .

    . . .

    init.war:

    war:
         [copy] Copying 27 files to /Users/arungupta/tools/jboss-seam-2.1.1.GA/examples/jpa/exploded-archives-glassfish/jboss-seam-jpa.war
         [copy] Copying 7 files to /Users/arungupta/tools/jboss-seam-2.1.1.GA/examples/jpa/exploded-archives-glassfish/jboss-seam-jpa.war/WEB-INF/lib

    noejb.war:
         [copy] Copying 18 files to /Users/arungupta/tools/jboss-seam-2.1.1.GA/examples/jpa/exploded-archives-glassfish/jboss-seam-jpa.war/WEB-INF/lib
         [copy] Copying 2 files to /Users/arungupta/tools/jboss-seam-2.1.1.GA/examples/jpa/exploded-archives-glassfish/jboss-seam-jpa.war
         [copy] Copying 4 files to /Users/arungupta/tools/jboss-seam-2.1.1.GA/examples/jpa/exploded-archives-glassfish/jboss-seam-jpa.war

    distributable.war:

    noejb.archive:
          [jar] Building jar: /Users/arungupta/tools/jboss-seam-2.1.1.GA/examples/jpa/dist-glassfish/jboss-seam-jpa.war

    BUILD SUCCESSFUL
    Total time: 5 seconds

  3. Deploy the sample as:
    ~/tools/jboss-seam-2.1.1.GA/examples/jpa >~/tools/glassfish/v2.1/glassfish/bin/asadmin deploy dist-glassfish/jboss-seam-jpa.war
    Command deploy executed successfully.

    The app is now accessible at “http://localhost:8080/jboss-seam-jpa” and here are some of the captured screenshots:

    Simple and easy!

  4. Build “examples/hibernate” as:
    ~/tools/jboss-seam-2.1.1.GA/examples/hibernate >ant glassfish
    Buildfile: build.xml

    glassfish:

    initcopy:

    initpoms:
         [echo] Setting up dependencies
         [copy] Copying 1 file to /Users/arungupta/tools/jboss-seam-2.1.1.GA/classes/poms
    [artifact:install] [INFO] Installing /Users/arungupta/tools/jboss-seam-2.1.1.GA/classes/poms/root.pom to /Users/arungupta/.m2/repository/org/jboss/seam/root/2.1.1.GA/root-2.1.1.GA.pom

     . . .

    distributable.war:

    noejb.archive:
          [jar] Building jar: /Users/arungupta/tools/jboss-seam-2.1.1.GA/examples/hibernate/dist-glassfish/jboss-seam-hibernate.war

    BUILD SUCCESSFUL
    Total time: 6 seconds

  5. Deploy the sample as:
    ~/tools/jboss-seam-2.1.1.GA/examples/hibernate >~/tools/glassfish/v2.1/glassfish/bin/asadmin deploy dist-glassfish/jboss-seam-hibernate.war
    Command deploy executed successfully.

    The app is now accessible at “http://localhost:8080/jboss-seam-hibernate” and has exactly similar snapshots as shown in “jboss-seam-jpa” sample. Simple and easy, yet again!

  6. Build “examples/jee5/booking” and deploy as:
    ~/tools/jboss-seam-2.1.1.GA/examples/jee5/booking >ant
    Buildfile: build.xml

    initcopy:

    initpoms:
         [echo] Setting up dependencies
         [copy] Copying 1 file to /Users/arungupta/tools/jboss-seam-2.1.1.GA/classes/poms
    [artifact:install] [INFO] Installing /Users/arungupta/tools/jboss-seam-2.1.1.GA/classes/poms/root.pom to /Users/arungupta/.m2/repository/org/jboss/seam/root/2.1.1.GA/root-2.1.1.GA.pom
         [copy] Copying 1 file to /Users/arungupta/tools/jboss-seam-2.1.1.GA/classes/poms

    . . .

    archive:
          [jar] Building jar: /Users/arungupta/tools/jboss-seam-2.1.1.GA/examples/jee5/booking/dist/jboss-seam-jee5-booking.jar
          [jar] Building jar: /Users/arungupta/tools/jboss-seam-2.1.1.GA/examples/jee5/booking/dist/jboss-seam-jee5-booking.war
          [jar] Building jar: /Users/arungupta/tools/jboss-seam-2.1.1.GA/examples/jee5/booking/dist/jboss-seam-jee5-booking.ear

    BUILD SUCCESSFUL
    Total time: 5 seconds
    ~/tools/jboss-seam-2.1.1.GA/examples/jee5/booking >~/tools/glassfish/v2.1/glassfish/bin/asadmin
    deploy dist/jboss-seam-jee5-booking.ear

    Command deploy executed successfully.

    The application is now accessible at “http://localhost:8080/seam-jee5-booking”. Wow, that’s simple and easy as well!

So we have deployed multiple Seam samples on GlassFish v2.1 – simple and easy!

Here are some more useful pointers realted to Seam and GlassFish:

  • Chapter 39 of the Seam Community Documentation even describes how to deploy an application created using seam-gen on GlassFish.
  • Dan Allen, the author of Manning’s Seam in Action, presented a webinar at TheAquarium Online.
  • Several other Seam entries @ TA.
  • Deploying a seam-gen project to GlassFish (blog entry) – Here is a quote from the blog:

    GlassFish has a very sexy administrative console, but it also has a very sexy commandline tool known as asadmin. The asadmin tool gives you virtually unbounded control over the application server, including core tasks such as starting and stopping the application server, deploying and undeploying applications, and setting up database connection pools, amidst a plethora of other controls. You’ll see that my modified seam-gen tool takes advantage of a handful of these commands.

    And another one …

    GlassFish gives you efficiency through automation, which is undoubtedly the most effective way to become efficient. … GlassFish volunteers itself to participate in a script and is the reason why I choose it as my preferred application server.

  • GlassFish support added to seam-gen: It is certainly exciting to know that there are targets like “gf-deploy-datasource”, “gf-deploy-hibernate”, and “gf-prepare” available to Seam developers out-of-the-box.
  • Sample Application using JSF, Seam, and Java Persistence APIs on GlassFish – detailed step-by-step blog explaining how to run Seam applications on GlassFish

The other samples in the bundle (that I tried) rely upon non-Java EE jars in the App Server’s classpath. A slight build file tweaking can bundle those jars in the application itself and will allow to run them as well.

Are you deploying your Seam applications on GlassFish ?

Happy Seaming on GlassFish!

Please leave suggestions on other TOTD (Tip Of The Day) that you’d like to see. A complete archive of all the tips is available here.

Technorati: totd seam glassfish javaee javaserverfaces ejb jpa

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 2, 2009

Silicon Valley Rails Meetup, Mar 2009 – Slides & Pics

Filed under: web2.0 — arungupta @ 4:00 am

I presented at Silicon Valley Rails Meetup yesterday. The official attendance says 79 and the kitchen area (for the presentation) was indeed packed!

The demo gods were hovering very much around and required me to reboot the machine – live during the presentation. Have you ever rebooted Mac because of a slow performance, smack in the middle of a demo ? ;-)

Here is a quote from the meetup:

The big win with glassfish is that it gives you the same environment in deployment and development.

The slides are available here. And some pointers to get more information:

And another one …

Thanks to Michael and Jerry for being the wonderful hosts!

Drop a comment on this blog if you are using GlassFish for your Rails/Merb/Sinatra/… deployments.

Technorati: conf glassfish rubyonrails jruby netbeans meetup

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
« Newer PostsOlder Posts »

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Powered by WordPress