The javax.sql
package provides the API for server-side database access. The main interfaces in the javax.sql
package are DataSource, ConnectionPoolDataSource
, and PooledConnection
. The DataSource
interface represents a factory for connections to a database. In Chapters 1 and 2, we obtained a Connection
object using the DriverManager
class. DataSource
is an alternative and a preferred method of obtaining a JDBC connection. An object that implements the DataSource
interface is typically registered with a Java Naming and Directory API-based naming service. DataSource
interface implementation is driver-vendor specific. The DataSource
interface has three types of implementations:
Basic implementation: In basic implementation there is 1:1 correspondence between a client's
Connection
object and the connection with the database. This implies that for everyConnection
object, there is a connection with the database. With the basic implementation, the overhead of...