The past few months, I've been developing a course on the
concepts of cloud computing and virtualization. It's coming along
very well, and this week I've been working on a demo for an
application in the cloud that uses a database located elsewhere
in the cloud (i.e. on another virtual server). I'd thought I
share the steps with you. I used MySQL, but the steps should be
similar for other databases.

Install MySQL on the server.

Create a new user for MySQL: create user USERNAME
identified by 'PASSWORD';

Grant the user access to the database: grant all
privileges on DATABASE.\* to USERNAME identified by
'PASSWORD';

Then I started up the IDE and went to the Services window,
where I connected to my local MySQL database.

After connecting, I right-clicked the MySQL driver node and
chose Connect Using.
The New Database Connection dialog box …

TOTD #93 showed how to get started with
Java
EE 6 using NetBeans 6.8 M1 and GlassFish v3 by
building a simple Servlet 3.0 + JPA 2.0 web application. TOTD #94 built upon it by using Java Server Faces
2 instead of Servlet 3.0 for displaying the results. However we
are still using a POJO for all the database interactions. This
works fine if we are only reading values from the database but
that's not how a typical web application behaves. The web
application would typically perform all CRUD operations. More
typically they like to perform one or more CRUD …

TOTD #93 showed how to get started with
Java
EE 6 using NetBeans 6.8 M1 and GlassFish v3 by
building a simple Servlet 3.0 + JPA 2.0 web application. TOTD #94 built upon it by using Java Server Faces
2 instead of Servlet 3.0 for displaying the results. However we
are still using a POJO for all the database interactions. This
works fine if we are only reading values from the database but
that's not how a typical web application behaves. The web
application would typically perform all CRUD operations. More
typically they like to perform one or more CRUD …

TOTD #93 showed how to get started with
Java
EE 6 using NetBeans 6.8 M1 and GlassFish v3 by
building a simple Servlet 3.0 + JPA 2.0 web application. TOTD #94 built upon it by using Java Server Faces
2 instead of Servlet 3.0 for displaying the results. However we
are still using a POJO for all the database interactions. This
works fine if we are only reading values from the database but
that's not how a typical web application behaves. The web
application would typically perform all CRUD operations. More
typically they like to perform one or more CRUD …

TOTD #93 showed how to get started with
Java
EE 6 using NetBeans 6.8 M1 and GlassFish v3 by
building a simple Servlet 3.0 + JPA 2.0 web application. JPA 2.0
+ Eclipselink was used for the database connectivity and Servlet
3.0 was used for displaying the results to the user. The sample
demonstrated how the two technologies can be mixed to create a
simple web application. But Servlets are meant for server-side
processing rather than displaying the results to end user.
JavaServer Faces 2 (another new specification in
Java EE 6) is designed to fulfill that purpose.

TOTD #93 showed how to get started with
Java
EE 6 using NetBeans 6.8 M1 and GlassFish v3 by
building a simple Servlet 3.0 + JPA 2.0 web application. JPA 2.0
+ Eclipselink was used for the database connectivity and Servlet
3.0 was used for displaying the results to the user. The sample
demonstrated how the two technologies can be mixed to create a
simple web application. But Servlets are meant for server-side
processing rather than displaying the results to end user.
JavaServer Faces 2 (another new specification in
Java EE 6) is designed to fulfill that purpose.
…

TOTD #93 showed how to get started with
Java
EE 6 using NetBeans 6.8 M1 and GlassFish v3 by
building a simple Servlet 3.0 + JPA 2.0 web application. JPA 2.0
+ Eclipselink was used for the database connectivity and Servlet
3.0 was used for displaying the results to the user. The sample
demonstrated how the two technologies can be mixed to create a
simple web application. But Servlets are meant for server-side
processing rather than displaying the results to end user.
JavaServer Faces 2 (another new specification in
Java EE 6) is designed to fulfill that purpose.

This Tip Of The Day (TOTD) shows how to create a simple web
application using JPA 2.0 and Servlet 3.0 and deploy on GlassFish
v3 latest promoted build (58 as of this writing). If you can work with
the one week older build then NetBeans 6.8 M1 comes pre-bundled
with 57. The example below should work fine on that as
well.

Create the database, table, and populate some data into it as
shown below:

This Tip Of The Day (TOTD) shows how to create a simple web
application using JPA 2.0 and Servlet 3.0 and deploy on GlassFish
v3 latest promoted build (58 as of this writing). If you can work with
the one week older build then NetBeans 6.8 M1 comes pre-bundled
with 57. The example below should work fine on that as
well.

Create the database, table, and populate some data into it as
shown below:

This Tip Of The Day (TOTD) shows how to create a simple web
application using JPA 2.0 and Servlet 3.0 and deploy on GlassFish
v3 latest promoted build (58 as of this writing). If you can work with
the one week older build then NetBeans 6.8 M1 comes pre-bundled
with 57. The example below should work fine on that as
well.

Create the database, table, and populate some data into it as
shown below:

Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.