As planned, today I conducted a techtalk-cum-demo on JDBC Connectivity, i.e. how to
connect a Java Application with a RDBMS(Relational Database Management System).
The target audience was totally new to the concept so i started off from the very scratch.
Following was the agenda:
# What is JDBC ?
# JDBC Architecture
-- 2 tier Architecture
-- 3 tier Architecture
# JDBC Drivers
# Connecting to Database
# Java Persistence API

It included the discussion of the importance of the application logic layer
and a brief comparison of Web Server and Application Server
It also emphasized the growing existence and importance of an application server like Glassfish in the industry.
At this point, i would like to mention that the students of the department have agreed to use Glassfish
in place of Tomcat as the application server.
2 Tier Applications embed the application logic in the jsp files and hence is visible to the user
3 tier apps add another layer which takes care of the business logic making it transparent to the user
and hence more preferred over corresponding 2 tier web apps.
One of the most popular way of implementing the application logic layer is to use Javabeans that can be easily
called in jsp files thus abstracting the details from the user.
I then talked in brief about the JDBC product components viz. the
JDBC API (java.sql and javax.sql) and
JNDI (Java Naming and Directory Interface)
Next, came information about different kinds of JDBC drivers. There are currently 221 drivers that
can be used to support a wide variety of databases. These drivers can be categorized into 4 major types.
The crux of the presentation was the actual code necessary to connect to the database.
As such, the process can be divided into three parts:
1. Load the driver
2. Connect to the database
3. Query the database
We use various classes and functions provided by JDBC API to achieve the above mentioned steps.

It followed with a demo with me building a small web app using Netbeans 6.0 + Glassfish
that interacts with MySQL and it worked !!
The students were happy to see that its so easy to connect and query the database
and i think this presentation will surely helped them in doing their semester projects
(i.e. to create a dynamic website using JSP)
After demonstrating to them how easy it was to use JDBC, i switched back to ppt and
introduced to them the concept of JPA (Java Persistence API)
I talked about how it is the next-generation industry standard for connectivity with DBMS/RDBMS
and is gaining popularity with each passing day.
I will strongly recommend reading Mr. Arun Gupta's blog entry:
http://blogs.sun.com/arungupta/entry/hello_jpa_world
showing how simple it is to build a Hello JPA World Application. Do read it!
The presentation ended with giving them a repertoire of web resources and talking about
Certifications and Trainings offered by Sun Microsystems.
The presentation ended with a round of applause, i hope that best describes how it went !!
The presentation for the same can be found on JUG-DU (the google group)
For any queries, please contact me on Agraj.Mangal@Sun.Com
connect a Java Application with a RDBMS(Relational Database Management System).
The target audience was totally new to the concept so i started off from the very scratch.
Following was the agenda:
# What is JDBC ?
# JDBC Architecture
-- 2 tier Architecture
-- 3 tier Architecture
# JDBC Drivers
# Connecting to Database
# Java Persistence API
It included the discussion of the importance of the application logic layer
and a brief comparison of Web Server and Application Server
It also emphasized the growing existence and importance of an application server like Glassfish in the industry.
At this point, i would like to mention that the students of the department have agreed to use Glassfish
in place of Tomcat as the application server.
2 Tier Applications embed the application logic in the jsp files and hence is visible to the user
3 tier apps add another layer which takes care of the business logic making it transparent to the user
and hence more preferred over corresponding 2 tier web apps.
One of the most popular way of implementing the application logic layer is to use Javabeans that can be easily
called in jsp files thus abstracting the details from the user.
I then talked in brief about the JDBC product components viz. the
JDBC API (java.sql and javax.sql) and
JNDI (Java Naming and Directory Interface)
Next, came information about different kinds of JDBC drivers. There are currently 221 drivers that
can be used to support a wide variety of databases. These drivers can be categorized into 4 major types.
The crux of the presentation was the actual code necessary to connect to the database.
As such, the process can be divided into three parts:
1. Load the driver
2. Connect to the database
3. Query the database
We use various classes and functions provided by JDBC API to achieve the above mentioned steps.
It followed with a demo with me building a small web app using Netbeans 6.0 + Glassfish
that interacts with MySQL and it worked !!
The students were happy to see that its so easy to connect and query the database
and i think this presentation will surely helped them in doing their semester projects
(i.e. to create a dynamic website using JSP)
After demonstrating to them how easy it was to use JDBC, i switched back to ppt and
introduced to them the concept of JPA (Java Persistence API)
I talked about how it is the next-generation industry standard for connectivity with DBMS/RDBMS
and is gaining popularity with each passing day.
I will strongly recommend reading Mr. Arun Gupta's blog entry:
http://blogs.sun.com/arungupta/entry/hello_jpa_world
showing how simple it is to build a Hello JPA World Application. Do read it!
The presentation ended with giving them a repertoire of web resources and talking about
Certifications and Trainings offered by Sun Microsystems.
The presentation ended with a round of applause, i hope that best describes how it went !!

The presentation for the same can be found on JUG-DU (the google group)
For any queries, please contact me on Agraj.Mangal@Sun.Com
My question is why java.sql and javax.sql are two different packages in java. It there is a logical reason for this you know so please mail me the answer.
Posted by Sushant on March 18, 2008 at 10:11 AM IST #
Hi sushant,
Well, java.sql provides us with an API that is core to the Java Platform (the core JDBC 2.1 API), it includes all addition made to the existing interfaces and classes.
On the other hand, javax.sql package has been introduced to contain the parts of JDBC API which are closely related to other pieces of Java Platform that are themselves optional packages, such as JNDI (Java Naming and Directory Interface) and JTS(Java Transaction Service) and some advanced features like Connection Pooling and Rowsets.
In a nutshell, javax.sql provides you with additional facilities which you may or may not want to use for your application. You can always work without using it and only use java.sql package
For more info refer to http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame4.html
Posted by Agraj on March 23, 2008 at 01:22 AM IST #