oracle.jdbc.datasource
.See: Description
Interface | Description |
---|---|
OracleCommonDataSource |
Interface that defines the methods which are common between
OracleDataSource , OracleXADataSource and
OracleConnectionPoolDataSource and defines the Oracle extensions
to the standard JDBC interface CommonDataSource . |
OracleConnectionPoolDataSource |
This interface defines the Oracle extensions to the standard JDBC interface
ConnectionPoolDataSource . |
OracleDataSource |
This interface defines the Oracle extensions to the standard JDBC interface
DataSource . |
OraclePooledConnection |
This interface defines the Oracle extensions to the standard JDBC interface
PooledConnection . |
OracleXAConnection |
This interface defines the Oracle extensions to the standard JDBC interface
XAConnection . |
OracleXADataSource |
This interface defines the Oracle extensions to the standard JDBC interface
XADataSource . |
Beginning in Oracle Release 12.2, some of the Oracle extensions to JDBC
are captured in the package oracle.jdbc.datasource
.
This package contains interfaces that extend standard JDBC interfaces
in javax.sql
.
For data source creations using Oracle JDBC driver 20c and
higher versions, we strongly recommend that your code use classes in
the oracle.jdbc.datasource.impl
package. This applies to both
standalone and application container use cases.
Data source classes in packages oracle.jdbc.pool
and
oracle.jdbc.replay
continue to function, but will be gradually
phased out. For data source creations using Oracle JDBC driver
19c and earlier versions, use these classes.
For most common scenarios, use
oracle.jdbc.datasource.impl.OracleDataSource
.
The following example illustrates the use of this data source to
create a JDBC connection:
oracle.jdbc.datasource.OracleDataSource ods =
new oracle.jdbc.datasource.impl.OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//dbhost:dbport/dbservice");
ods.setUser("User");
ods.setPassword("Passwd");
ods.setConnectionProperty("connProp1", "value1");
ods.setConnectionProperty("connProp2", "value2");
Connection conn = ods.getConnection();
The following example illustrates the use of this data source with the Oracle Universal Connection Pool (UCP):
oracle.ucp.jdbc.PoolDataSource pds =
oracle.ucp.jdbc.PoolDataSourceFactory.getPoolDataSource();
pds.setConnectionFactoryClassName(
"oracle.jdbc.datasource.impl.OracleDataSource");
pds.setURL("jdbc:oracle:thin:@//dbhost:dbport/dbservice");
pds.setUser("User");
pds.setPassword("Passwd");
pds.setConnectionProperty("connProp1", "value1");
pds.setConnectionProperty("connProp2", "value2");
Connection conn = pds.getConnection();
...... // JDBC calls
conn.close(); // return connection to UCP
The following example illustrates the use of a connection obtained from this data source for Application Continuity protection (note that you must use an AC database service):
oracle.jdbc.datasource.OracleDataSource ods =
new oracle.jdbc.datasource.impl.OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//dbhost:dbport/AC_service");
ods.setUser("User");
ods.setPassword("Passwd");
ods.setConnectionProperty("connProp1", "value1");
ods.setConnectionProperty("connProp2", "value2");
oracle.jdbc.OracleConnection conn =
(oracle.jdbc.OracleConnection) ods.getConnection();
conn.beginRequest();
...... // JDBC calls protected by AC
conn.endRequest();
The following example illustrates the use of this data source with both UCP and Application Continuity:
oracle.ucp.jdbc.PoolDataSource pds =
oracle.ucp.jdbc.PoolDataSourceFactory.getPoolDataSource();
pds.setConnectionFactoryClassName(
"oracle.jdbc.datasource.impl.OracleDataSource");
pds.setURL("jdbc:oracle:thin:@//dbhost:dbport/AC_service");
pds.setUser("User");
pds.setPassword("Passwd");
pds.setConnectionProperty("connProp1", "value1");
pds.setConnectionProperty("connProp2", "value2");
Connection conn = pds.getConnection();
...... // JDBC calls protected by AC
conn.close(); // return connection to UCP
oracle.jdbc.datasource.impl.OracleConnectionPoolDataSource
is for connection pool implementers, and should rarely be used directly.javax.sql
,
oracle.jdbc.datasource.impl
,
oracle.jdbc.pool
,
oracle.jdbc.replay