Tuning the Java Database Connectivity API
Java Database Connectivity (JDBC) is the Java standard that defines how a client accesses a (in most cases, relational) database. The different database vendors provide an implementation of this API, often called a JDBC driver.
Even if the basic purpose of JDBC is to provide a standardized way of executing native SQL statements and handling the result sets, it's often used as a foundation for other frameworks, for example, JPA or Hibernate.
Performance-tuning JDBC consists of the following processes:
Introducing a database connection pool that reuses your connections
Making use of proper JDBC features, such as fetch size and batch size
Using prepared statements in your application and configuring a prepared statement cache at application server level
Connection pooling
The first basic rule you need to follow when programming JDBC is to use a connection pool when accessing a database. Establishing database connections, depending upon the platform, can take...