Package org.osgi.service.jdbc
Interface DataSourceFactory
-
public interface DataSourceFactory
A factory for JDBC connection factories. There are 3 preferred connection factories for getting JDBC connections:javax.sql.DataSource
,javax.sql.ConnectionPoolDataSource
, andjavax.sql.XADataSource
. DataSource providers should implement this interface and register it as an OSGi service with the JDBC driver class name in theOSGI_JDBC_DRIVER_CLASS
property.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
JDBC_DATABASE_NAME
The "databaseName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static java.lang.String
JDBC_DATASOURCE_NAME
The "dataSourceName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static java.lang.String
JDBC_DESCRIPTION
The "description" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static java.lang.String
JDBC_INITIAL_POOL_SIZE
The "initialPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static java.lang.String
JDBC_MAX_IDLE_TIME
The "maxIdleTime" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static java.lang.String
JDBC_MAX_POOL_SIZE
The "maxPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static java.lang.String
JDBC_MAX_STATEMENTS
The "maxStatements" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static java.lang.String
JDBC_MIN_POOL_SIZE
The "minPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static java.lang.String
JDBC_NETWORK_PROTOCOL
The "networkProtocol" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static java.lang.String
JDBC_PASSWORD
The "password" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static java.lang.String
JDBC_PORT_NUMBER
The "portNumber" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static java.lang.String
JDBC_PROPERTY_CYCLE
The "propertyCycle" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static java.lang.String
JDBC_ROLE_NAME
The "roleName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static java.lang.String
JDBC_SERVER_NAME
The "serverName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static java.lang.String
JDBC_URL
The "url" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static java.lang.String
JDBC_USER
The "user" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static java.lang.String
OSGI_JDBC_DRIVER_CLASS
Service property used by a JDBC driver to declare the driver class when registering a JDBC DataSourceFactory service.static java.lang.String
OSGI_JDBC_DRIVER_NAME
Service property used by a JDBC driver to declare the driver name when registering a JDBC DataSourceFactory service.static java.lang.String
OSGI_JDBC_DRIVER_VERSION
Service property used by a JDBC driver to declare the driver version when registering a JDBC DataSourceFactory service.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description javax.sql.ConnectionPoolDataSource
createConnectionPoolDataSource(java.util.Properties props)
Create a newConnectionPoolDataSource
using the given properties.javax.sql.DataSource
createDataSource(java.util.Properties props)
Create a newDataSource
using the given properties.java.sql.Driver
createDriver(java.util.Properties props)
Create a newDriver
using the given properties.javax.sql.XADataSource
createXADataSource(java.util.Properties props)
Create a newXADataSource
using the given properties.
-
-
-
Field Detail
-
OSGI_JDBC_DRIVER_CLASS
static final java.lang.String OSGI_JDBC_DRIVER_CLASS
Service property used by a JDBC driver to declare the driver class when registering a JDBC DataSourceFactory service. Clients may filter or test this property to determine if the driver is suitable, or the desired one.- See Also:
- Constant Field Values
-
OSGI_JDBC_DRIVER_NAME
static final java.lang.String OSGI_JDBC_DRIVER_NAME
Service property used by a JDBC driver to declare the driver name when registering a JDBC DataSourceFactory service. Clients may filter or test this property to determine if the driver is suitable, or the desired one.- See Also:
- Constant Field Values
-
OSGI_JDBC_DRIVER_VERSION
static final java.lang.String OSGI_JDBC_DRIVER_VERSION
Service property used by a JDBC driver to declare the driver version when registering a JDBC DataSourceFactory service. Clients may filter or test this property to determine if the driver is suitable, or the desired one.- See Also:
- Constant Field Values
-
JDBC_DATABASE_NAME
static final java.lang.String JDBC_DATABASE_NAME
The "databaseName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
- Constant Field Values
-
JDBC_DATASOURCE_NAME
static final java.lang.String JDBC_DATASOURCE_NAME
The "dataSourceName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
- Constant Field Values
-
JDBC_DESCRIPTION
static final java.lang.String JDBC_DESCRIPTION
The "description" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
- Constant Field Values
-
JDBC_NETWORK_PROTOCOL
static final java.lang.String JDBC_NETWORK_PROTOCOL
The "networkProtocol" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
- Constant Field Values
-
JDBC_PASSWORD
static final java.lang.String JDBC_PASSWORD
The "password" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
- Constant Field Values
-
JDBC_PORT_NUMBER
static final java.lang.String JDBC_PORT_NUMBER
The "portNumber" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
- Constant Field Values
-
JDBC_ROLE_NAME
static final java.lang.String JDBC_ROLE_NAME
The "roleName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
- Constant Field Values
-
JDBC_SERVER_NAME
static final java.lang.String JDBC_SERVER_NAME
The "serverName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
- Constant Field Values
-
JDBC_USER
static final java.lang.String JDBC_USER
The "user" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
- Constant Field Values
-
JDBC_URL
static final java.lang.String JDBC_URL
The "url" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
- Constant Field Values
-
JDBC_INITIAL_POOL_SIZE
static final java.lang.String JDBC_INITIAL_POOL_SIZE
The "initialPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
- Constant Field Values
-
JDBC_MAX_IDLE_TIME
static final java.lang.String JDBC_MAX_IDLE_TIME
The "maxIdleTime" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
- Constant Field Values
-
JDBC_MAX_POOL_SIZE
static final java.lang.String JDBC_MAX_POOL_SIZE
The "maxPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
- Constant Field Values
-
JDBC_MAX_STATEMENTS
static final java.lang.String JDBC_MAX_STATEMENTS
The "maxStatements" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
- Constant Field Values
-
JDBC_MIN_POOL_SIZE
static final java.lang.String JDBC_MIN_POOL_SIZE
The "minPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
- Constant Field Values
-
JDBC_PROPERTY_CYCLE
static final java.lang.String JDBC_PROPERTY_CYCLE
The "propertyCycle" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
- Constant Field Values
-
-
Method Detail
-
createDataSource
javax.sql.DataSource createDataSource(java.util.Properties props) throws java.sql.SQLException
Create a newDataSource
using the given properties.- Parameters:
props
- The properties used to configure theDataSource
.null
indicates no properties. If the property cannot be set on theDataSource
being created then aSQLException
must be thrown.- Returns:
- A configured
DataSource
. - Throws:
java.sql.SQLException
- If theDataSource
cannot be created.
-
createConnectionPoolDataSource
javax.sql.ConnectionPoolDataSource createConnectionPoolDataSource(java.util.Properties props) throws java.sql.SQLException
Create a newConnectionPoolDataSource
using the given properties.- Parameters:
props
- The properties used to configure theConnectionPoolDataSource
.null
indicates no properties. If the property cannot be set on theConnectionPoolDataSource
being created then aSQLException
must be thrown.- Returns:
- A configured
ConnectionPoolDataSource
. - Throws:
java.sql.SQLException
- If theConnectionPoolDataSource
cannot be created.
-
createXADataSource
javax.sql.XADataSource createXADataSource(java.util.Properties props) throws java.sql.SQLException
Create a newXADataSource
using the given properties.- Parameters:
props
- The properties used to configure theXADataSource
.null
indicates no properties. If the property cannot be set on theXADataSource
being created then aSQLException
must be thrown.- Returns:
- A configured
XADataSource
. - Throws:
java.sql.SQLException
- If theXADataSource
cannot be created.
-
createDriver
java.sql.Driver createDriver(java.util.Properties props) throws java.sql.SQLException
Create a newDriver
using the given properties.- Parameters:
props
- The properties used to configure theDriver
.null
indicates no properties. If the property cannot be set on theDriver
being created then aSQLException
must be thrown.- Returns:
- A configured
Driver
. - Throws:
java.sql.SQLException
- If theDriver
cannot be created.
-
-