1
/*****************************************************************************
2
* Copyright (C) 2008 EnterpriseDB Corporation.
3
* Copyright (C) 2011 Stado Global Development Group.
5
* This file is part of Stado.
7
* Stado is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* Stado is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with Stado. If not, see <http://www.gnu.org/licenses/>.
20
* You can find Stado at http://www.stado.us
22
****************************************************************************/
23
package org.postgresql.driver.ds;
25
import javax.sql.DataSource;
28
* DataSource which uses connection pooling. <font color="red">Don't use this if
29
* your server/middleware vendor provides a connection pooling implementation
30
* which interfaces with the PostgreSQL ConnectionPoolDataSource implementation!</font>
31
* This class is provided as a convenience, but the JDBC Driver is really not
32
* supposed to handle the connection pooling algorithm. Instead, the server or
33
* middleware product is supposed to handle the mechanics of connection pooling,
34
* and use the PostgreSQL implementation of ConnectionPoolDataSource to provide
35
* the connections to pool.
37
* <p>If you're sure you want to use this, then you must set the properties
38
* dataSourceName, databaseName, user, and password (if required for the user).
39
* The settings for serverName, portNumber, initialConnections, and
40
* maxConnections are optional. Note that <i>only connections
41
* for the default user will be pooled!</i> Connections for other users will
42
* be normal non-pooled connections, and will not count against the maximum pool
45
* <p>If you put this DataSource in JNDI, and access it from different JVMs (or
46
* otherwise load this class from different ClassLoaders), you'll end up with one
47
* pool per ClassLoader or VM. This is another area where a server-specific
48
* implementation may provide advanced features, such as using a single pool
49
* across all VMs in a cluster.</p>
51
* <p>This implementation supports JDK 1.3 and higher.</p>
53
* @author Aaron Mulder (ammulder@chariotsolutions.com)
55
public class PGPoolingDataSource
56
extends org.postgresql.driver.ds.jdbc4.AbstractJdbc4PoolingDataSource
60
protected void addDataSource(String dataSourceName)
62
dataSources.put(dataSourceName, this);