You are on page 1of 2

ADVANCED JDBC

Advanced JDBC

1. Connection Pooling.

2. Transaction Management.

The above 2 advanced topics are implemented in the package called javax.sql .

1. Connection Pooling:- Till now we used DriverManager to establish connection


to the database. When you are using DriverManager connection management
following are the problems.

• We need to hardcode Driver class, url, uid, pwd, in every jdbc program. In
future if the database is migrated then you need to modify everywhere in the
program. This increases the maintenance of the application and reduces the
system flexibility.

• When we use DriverManager connection management connection will be


created newly. After using the connection it will be closed. Creating and
destroying the connection everytime is expensive and increases the burden
on the application. This indirectly hits the performance of the application.

The problem discussed above can be solved when you replace DriverManager
connection management with DataSource connection management.
JNDI Registry
(LDAP Server)
hello
datasource
datasource datasour
ce

Object o = c c
ctx.lookup(“hello”); o o
cn cn
ds = (DataSource)o; o o
Java program n n

Application Server

Programmer has to provide these details to the Server.

1) Database(Oracle)

2) Driver class

3) url

HARISH Page 1
ADVANCED JDBC

4) uid

5) pwd

6) number of connections required.

HARISH Page 2

You might also like