org.xerial.db.sql
Class ConnectionPoolImpl
java.lang.Object
org.xerial.db.sql.ConnectionPoolImpl
- All Implemented Interfaces:
- ConnectionPool
public class ConnectionPoolImpl
- extends Object
- implements ConnectionPool
ConnectionPoolImpl class holds established JDBC connections. For each time
you get a connection, you must return it to the ConnectionPoolImpl by calling
returnConnection(connection).
- Author:
- leo
|
Constructor Summary |
ConnectionPoolImpl(String JDBCDriver,
String databaseAddress)
Create an connection pool, in which only a single connection is pooled
This constructer is suited for memory database usage, which demands the
same connection must always be returned to the user |
ConnectionPoolImpl(String JDBCDriver,
String databaseAddress,
int numConnection)
|
ConnectionPoolImpl(String JDBCDriver,
String databaseAddress,
String user,
String pass)
|
ConnectionPoolImpl(String JDBCDriver,
String databaseAddress,
String user,
String pass,
int numConnection)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConnectionPoolImpl
public ConnectionPoolImpl(String JDBCDriver,
String databaseAddress)
throws DBException
- Create an connection pool, in which only a single connection is pooled
This constructer is suited for memory database usage, which demands the
same connection must always be returned to the user
- Parameters:
JDBCdriver - driver name: e.g. "org.sqlite.JDBC"databaseAddress - database address, e.g. "jdbc:sqlite:db.sqilte3"
- Throws:
DBException - when loading the driver or to establish connections fail
ConnectionPoolImpl
public ConnectionPoolImpl(String JDBCDriver,
String databaseAddress,
int numConnection)
throws DBException
- Parameters:
JDBCdriver - driver name: e.g. "org.sqlite.JDBC"databaseAddress - database address, e.g. "jdbc:sqlite:db.sqilte3"the - number of connections to keep
- Throws:
DBException - when loading the driver or to establish connections fail
ConnectionPoolImpl
public ConnectionPoolImpl(String JDBCDriver,
String databaseAddress,
String user,
String pass)
throws DBException
- Throws:
DBException
ConnectionPoolImpl
public ConnectionPoolImpl(String JDBCDriver,
String databaseAddress,
String user,
String pass,
int numConnection)
throws DBException
- Throws:
DBException
establishConnections
public void establishConnections(String user,
String pass)
throws DBException
- Throws:
DBException
establishConnections
public void establishConnections()
throws DBException
- Throws:
DBException
add
public void add(Connection establishedConnection)
getConnection
public Connection getConnection()
throws DBException
- Specified by:
getConnection in interface ConnectionPool
- Throws:
DBException
returnConnection
public void returnConnection(Connection leasedConnection)
- Specified by:
returnConnection in interface ConnectionPool
closeAll
public void closeAll()
throws DBException
- Specified by:
closeAll in interface ConnectionPool
- Throws:
DBException

This work is licensed under a Creative Commons Attribution-ShareAlike 2.1 Japan License.