The Pet Catalog application is a Java EE 6 sample that demonstrates usage of JavaServer Faces 2.0 and the Java Persistence API. Setup instructions here assume that you are using the following software components:
For more information on the Pet Catalog Sample Application, see: http://netbeans.org/kb/samples/pet-catalog.html.
Setup instructions use 'root' / 'nbuser' as the user
                account / password combination for access to the MySQL server. Do not
                use an empty database password.
nbuser'bin directory
                        within your MySQL installation.
                        shell> cd <install-dir>/bin(Where
<install-dir> is the path to your MySQL
                        installation directory.)
shell> mysql -u root
mysql> UPDATE mysql.user SET Password = PASSWORD('nbuser') WHERE User = 'root';
mysql> FLUSH PRIVILEGES;
                        For more information, see the official MySQL Reference Manual:
                        Securing
                        the Initial MySQL Accounts.
                    
localhost3306rootnbuser
petcatalog. Select the
                        'Grant Full Access to' option, then select root@localhost from
                        the drop-down field.
                        
                         
                        petcatalog is
                        created, and a connection to the database is automatically established.
                        Connections are displayed in the Services window using a connection node (
                         ).
 ).catalog.sql to open it in the IDE's editor.jdbc:mysql://localhost:3306/petcatalog connection that you
                        created in the previous step. ) button in the editor's toolbar. The script runs on your MySQL server.
                        ) button in the editor's toolbar. The script runs on your MySQL server.The glassfish-resources.xml file, included in the sample application, is a
                GlassFish-specific deployment descriptor. If you open the file in the editor (from
                the Projects window, Server Resources > glassfish-resources.xml), you can
                see that the file instructs the GlassFish server to create a connection pool named
                petCatalogPool using the 'root' / 'nbuser'
                combination and jdbc:mysql://localhost:3306/petcatalog connection you
                configured in the previous steps:
<jdbc-connection-pool allow-non-component-callers="false"
                      associate-with-thread="false"
                      connection-creation-retry-attempts="0"
                      connection-creation-retry-interval-in-seconds="10"
                      connection-leak-reclaim="false"
                      connection-leak-timeout-in-seconds="0"
                      connection-validation-method="auto-commit"
                      datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
                      fail-all-connections="false"
                      idle-timeout-in-seconds="300"
                      is-connection-validation-required="false"
                      is-isolation-level-guaranteed="true"
                      lazy-connection-association="false"
                      lazy-connection-enlistment="false"
                      match-connections="false"
                      max-connection-usage-count="0"
                      max-pool-size="32"
                      max-wait-time-in-millis="60000"
                      name="petCatalogPool"
                      non-transactional-connections="false"
                      pool-resize-quantity="2"
                      res-type="javax.sql.ConnectionPoolDataSource"
                      statement-timeout-in-seconds="-1"
                      steady-pool-size="8"
                      validate-atmost-once-period-in-seconds="0"
                      wrap-jdbc-objects="false">
  <property name="URL" value="jdbc:mysql://localhost:3306/petcatalog"/>
  <property name="User" value="root"/>
  <property name="Password" value="nbuser"/>
</jdbc-connection-pool>
            The glassfish-resources.xml file also instructs the GlassFish server
                to configure a data source that uses the petCatalogPool connection
                pool and sets its JNDI name to 'jdbc/petcatalog':
<jdbc-resource enabled="true"
               jndi-name="jdbc/petcatalog"
               object-type="user"
               pool-name="petCatalogPool">
</jdbc-resource>
            PetCatalog project node
                    and choose Run. The project is compiled, packaged and deployed to GlassFish.
                    The deployed application then opens in your default browser.
                    