Package org.webharvest.runtime.database
Interface ConnectionFactory
-
- All Known Implementing Classes:
JNDIConnectionFactory
,StandaloneConnectionPool
public interface ConnectionFactory
Factory responsible for creating SQLConnection
s basis on the provided parameters.ConnectionFactory
encapsulates all connection configuration details under the hood, allowing to switch between particular implementations transparently.- Since:
- 2.1.0-SNAPSHOT
- Version:
- %I%, %G%
- Author:
- Piotr Dyraga
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Connection
getConnection(String name)
Returns SQLConnection
instance available under the given name (for example under JNDI name within Java EE container).Connection
getConnection(String driver, String url, String username, String password)
Returns SQLConnection
instance configured according to provided parameters.
-
-
-
Method Detail
-
getConnection
Connection getConnection(String name)
Returns SQLConnection
instance available under the given name (for example under JNDI name within Java EE container). If noConnection
has been bound to the provided name, thenDatabaseException
containing root cause is thrown.- Parameters:
name
- name to which connection is bound- Returns:
- ready for use
Connection
instance bound to the given name, nevernull
-
getConnection
Connection getConnection(String driver, String url, String username, String password)
Returns SQLConnection
instance configured according to provided parameters.- Parameters:
driver
- fully qualified name of the database driver; mandatory, must not benull
url
- JDBC connection url; mandatory, must not benull
username
- database usernamepassword
- database password- Returns:
- ready for use
Connection
instance
-
-