Data sources
As defined in the JDBC 2.0 Standard Extension specification, data sources allow you to manage a pool of connections to a database. Using connection pools provides you with the following advantages:
- It improves performance. Creating connections is expensive; a data source creates a connection as soon as it is instantiated.
- It simplifies resource allocation. Resources are only allocated from the data sources, and not at arbitrary places in the code.
- It simplifies connection calls. To get a connection in JDBC 1.0, you would need to call Class.forName() on the class name of the database driver, before making DriverManager calls.
Data sources work as follows:
- When a client wants to use a connection, it looks up a data source by name from a JNDI server.
- The data source then returns a connection to the client.
- If the data source has no more connections, it may ask the database manager for more connections (as long as it has not exceeded the maximum number of connections).
- When the client has finished with the connection, it closes the connection.
- The data source then returns the connection to the available pool.
You can configure data sources for WebSphere® Application Server by using the Deployment page in the application deployment descriptor editor or using the administrative console.