Package org.openbravo.database
Class ConnectionProviderImpl
- java.lang.Object
-
- org.openbravo.database.ConnectionProviderImpl
-
- All Implemented Interfaces:
ConnectionProvider
public class ConnectionProviderImpl extends Object implements ConnectionProvider
-
-
Constructor Summary
Constructors Constructor Description ConnectionProviderImpl(String file)
ConnectionProviderImpl(String file, boolean isRelative, String _context)
ConnectionProviderImpl(String file, String _context)
ConnectionProviderImpl(Properties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNewPool(String dbDriver, String dbServer, String dbLogin, String dbPassword, int minConns, int maxConns, double maxConnTime, String dbSessionConfig, String _rdbms, String name)
void
destroy()
void
destroy(String name)
CallableStatement
getCallableStatement(String SQLCallableStatement)
CallableStatement
getCallableStatement(String poolName, String SQLCallableStatement)
CallableStatement
getCallableStatement(Connection conn, String SQLCallableStatement)
Connection
getConnection()
Connection
getConnection(String poolName)
Optimization, try to get the connection associated with the current thread, to always get the same connection for all getConnection() calls inside a request.org.apache.commons.pool.ObjectPool
getPool()
org.apache.commons.pool.ObjectPool
getPool(String poolName)
PreparedStatement
getPreparedStatement(String SQLPreparedStatement)
PreparedStatement
getPreparedStatement(String poolName, String SQLPreparedStatement)
PreparedStatement
getPreparedStatement(Connection conn, String SQLPreparedStatement)
String
getRDBMS()
Statement
getStatement()
Statement
getStatement(String poolName)
Statement
getStatement(Connection conn)
String
getStatus()
Returns the actual status of the dynamic pool.Connection
getTransactionConnection()
void
releaseCallableStatement(CallableStatement callableStatement)
void
releaseCommitConnection(Connection conn)
boolean
releaseConnection(Connection conn)
void
releasePreparedStatement(PreparedStatement preparedStatement)
void
releaseRollbackConnection(Connection conn)
void
releaseStatement(Statement statement)
void
releaseTransactionalPreparedStatement(PreparedStatement preparedStatement)
void
releaseTransactionalStatement(Statement statement)
void
reload(String file, boolean isRelative, String _context)
-
-
-
Constructor Detail
-
ConnectionProviderImpl
public ConnectionProviderImpl(Properties properties) throws PoolNotFoundException
- Throws:
PoolNotFoundException
-
ConnectionProviderImpl
public ConnectionProviderImpl(String file) throws PoolNotFoundException
- Throws:
PoolNotFoundException
-
ConnectionProviderImpl
public ConnectionProviderImpl(String file, String _context) throws PoolNotFoundException
- Throws:
PoolNotFoundException
-
ConnectionProviderImpl
public ConnectionProviderImpl(String file, boolean isRelative, String _context) throws PoolNotFoundException
- Throws:
PoolNotFoundException
-
-
Method Detail
-
reload
public void reload(String file, boolean isRelative, String _context) throws Exception
- Throws:
Exception
-
destroy
public void destroy() throws Exception
- Specified by:
destroy
in interfaceConnectionProvider
- Throws:
Exception
-
addNewPool
public void addNewPool(String dbDriver, String dbServer, String dbLogin, String dbPassword, int minConns, int maxConns, double maxConnTime, String dbSessionConfig, String _rdbms, String name) throws Exception
- Throws:
Exception
-
getPool
public org.apache.commons.pool.ObjectPool getPool(String poolName) throws PoolNotFoundException
- Throws:
PoolNotFoundException
-
getPool
public org.apache.commons.pool.ObjectPool getPool() throws PoolNotFoundException
- Throws:
PoolNotFoundException
-
getConnection
public Connection getConnection() throws NoConnectionAvailableException
- Specified by:
getConnection
in interfaceConnectionProvider
- Throws:
NoConnectionAvailableException
-
getConnection
public Connection getConnection(String poolName) throws NoConnectionAvailableException
Optimization, try to get the connection associated with the current thread, to always get the same connection for all getConnection() calls inside a request.- Throws:
NoConnectionAvailableException
-
getRDBMS
public String getRDBMS()
- Specified by:
getRDBMS
in interfaceConnectionProvider
-
releaseConnection
public boolean releaseConnection(Connection conn)
-
getTransactionConnection
public Connection getTransactionConnection() throws NoConnectionAvailableException, SQLException
- Specified by:
getTransactionConnection
in interfaceConnectionProvider
- Throws:
NoConnectionAvailableException
SQLException
-
releaseCommitConnection
public void releaseCommitConnection(Connection conn) throws SQLException
- Specified by:
releaseCommitConnection
in interfaceConnectionProvider
- Throws:
SQLException
-
releaseRollbackConnection
public void releaseRollbackConnection(Connection conn) throws SQLException
- Specified by:
releaseRollbackConnection
in interfaceConnectionProvider
- Throws:
SQLException
-
getPreparedStatement
public PreparedStatement getPreparedStatement(String SQLPreparedStatement) throws Exception
- Specified by:
getPreparedStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getPreparedStatement
public PreparedStatement getPreparedStatement(String poolName, String SQLPreparedStatement) throws Exception
- Specified by:
getPreparedStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getPreparedStatement
public PreparedStatement getPreparedStatement(Connection conn, String SQLPreparedStatement) throws SQLException
- Specified by:
getPreparedStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
getCallableStatement
public CallableStatement getCallableStatement(String SQLCallableStatement) throws Exception
- Specified by:
getCallableStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getCallableStatement
public CallableStatement getCallableStatement(String poolName, String SQLCallableStatement) throws Exception
- Specified by:
getCallableStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getCallableStatement
public CallableStatement getCallableStatement(Connection conn, String SQLCallableStatement) throws SQLException
- Specified by:
getCallableStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
getStatement
public Statement getStatement() throws Exception
- Specified by:
getStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getStatement
public Statement getStatement(String poolName) throws Exception
- Specified by:
getStatement
in interfaceConnectionProvider
- Throws:
Exception
-
getStatement
public Statement getStatement(Connection conn) throws SQLException
- Specified by:
getStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
releasePreparedStatement
public void releasePreparedStatement(PreparedStatement preparedStatement) throws SQLException
- Specified by:
releasePreparedStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
releaseCallableStatement
public void releaseCallableStatement(CallableStatement callableStatement) throws SQLException
- Specified by:
releaseCallableStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
releaseStatement
public void releaseStatement(Statement statement) throws SQLException
- Specified by:
releaseStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
releaseTransactionalStatement
public void releaseTransactionalStatement(Statement statement) throws SQLException
- Specified by:
releaseTransactionalStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
releaseTransactionalPreparedStatement
public void releaseTransactionalPreparedStatement(PreparedStatement preparedStatement) throws SQLException
- Specified by:
releaseTransactionalPreparedStatement
in interfaceConnectionProvider
- Throws:
SQLException
-
getStatus
public String getStatus()
Returns the actual status of the dynamic pool.- Specified by:
getStatus
in interfaceConnectionProvider
-
-