0% found this document useful (0 votes)
33 views2 pages

Advanced JDBC (Connection Pooling)

This document discusses two advanced JDBC topics: 1) Connection Pooling and 2) Transaction Management. Connection pooling solves problems with the traditional DriverManager connection management approach by replacing it with DataSource connection management. This allows connections to be reused from a pool rather than constantly opening and closing new connections, improving performance. It also removes hardcoded database configuration from code. Transaction management allows grouping statements into transactions for atomic, consistent, isolated, and durable data access and updates.

Uploaded by

Harish Minchu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views2 pages

Advanced JDBC (Connection Pooling)

This document discusses two advanced JDBC topics: 1) Connection Pooling and 2) Transaction Management. Connection pooling solves problems with the traditional DriverManager connection management approach by replacing it with DataSource connection management. This allows connections to be reused from a pool rather than constantly opening and closing new connections, improving performance. It also removes hardcoded database configuration from code. Transaction management allows grouping statements into transactions for atomic, consistent, isolated, and durable data access and updates.

Uploaded by

Harish Minchu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 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