Package org.datanucleus.api.jdo
Class JDOConnectionJDBCImpl
java.lang.Object
org.datanucleus.api.jdo.JDOConnectionImpl
org.datanucleus.api.jdo.JDOConnectionJDBCImpl
- All Implemented Interfaces:
AutoCloseable,Connection,Wrapper,javax.jdo.datastore.JDOConnection
Implementation of a JDO connection that is also a wrapper for "java.sql.Connection".
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConnectionThe JDBC connection (shortcut for the native connection of the NucleusConnection).private booleanwhether this connection is available to the developerFields inherited from class org.datanucleus.api.jdo.JDOConnectionImpl
nucConnFields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE -
Constructor Summary
ConstructorsConstructorDescriptionJDOConnectionJDBCImpl(org.datanucleus.store.NucleusConnection nconn) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidAssert the JDOConnection is available.voidMethod to clear warnings from the connection.voidcommit()Method to commit the connection.createArrayOf(String typeName, Object[] elements) Accessor for a statement.createStatement(int resultSetType, int resultSetConcurrency) Accessor for a statement.createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) Accessor for a statement.createStruct(String typeName, Object[] attributes) booleanAccessor for the autocommit setting.Accessor for the catalog.getClientInfo(String name) intAccess the holdability of the connection.Accessor for the database metadata.intintAccessor for the transaction isolation level.Accessor for the type map.Accessor for the warnings.booleanbooleanisClosed()Accessor for whether the connection is closed.booleanAccessor for whether the connection is read only.booleanisValid(int timeout) booleanisWrapperFor(Class iface) Accessor for using native SQL.prepareCall(String sql) prepareCall(String sql, int resultSetType, int resultSetConcurrency) prepareCall(String arg0, int arg1, int arg2, int arg3) prepareStatement(String sql) prepareStatement(String arg0, int arg1) prepareStatement(String arg0, int[] arg1) prepareStatement(String sql, int resultSetType, int resultSetConcurrency) prepareStatement(String arg0, int arg1, int arg2, int arg3) prepareStatement(String arg0, String[] arg1) voidMutator to release the savepoint.voidrollback()Method to rollback the connection.voidMutator to rollback the savepoint.voidsetAutoCommit(boolean autoCommit) Method to set the autocommit for the connection.voidsetCatalog(String catalog) Mutator for the catalogvoidsetClientInfo(String name, String value) voidsetClientInfo(Properties properties) voidsetHoldability(int holdability) Method to set the holdability for the connection.voidsetNetworkTimeout(Executor executor, int milliseconds) voidsetReadOnly(boolean readOnly) Method to set the read-only nature for the connection.Mutator to set the savepoint.setSavepoint(String arg0) voidvoidsetTransactionIsolation(int level) Method to set the transaction isolation for the connection.voidsetTypeMap(Map map) Method to set the type map<T> TMethods inherited from class org.datanucleus.api.jdo.JDOConnectionImpl
close, getNativeConnection, throwExceptionNotAvailable, throwExceptionUnsupportedOperationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.sql.Connection
beginRequest, close, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
Field Details
-
conn
The JDBC connection (shortcut for the native connection of the NucleusConnection). -
isAvailable
private boolean isAvailablewhether this connection is available to the developer
-
-
Constructor Details
-
JDOConnectionJDBCImpl
public JDOConnectionJDBCImpl(org.datanucleus.store.NucleusConnection nconn) Constructor.- Parameters:
nconn- The Nucleus Connection delegate
-
-
Method Details
-
isAvailable
public boolean isAvailable() -
getHoldability
Access the holdability of the connection.- Specified by:
getHoldabilityin interfaceConnection- Returns:
- The holdability
- Throws:
SQLException- if there is a problem
-
getTransactionIsolation
Accessor for the transaction isolation level.- Specified by:
getTransactionIsolationin interfaceConnection- Returns:
- The isolation level
- Throws:
SQLException- if there is a problem
-
clearWarnings
Method to clear warnings from the connection.- Specified by:
clearWarningsin interfaceConnection- Throws:
SQLException- thrown if there is a problem
-
commit
Method to commit the connection.- Specified by:
commitin interfaceConnection- Throws:
SQLException- thrown if an error occurs.
-
rollback
Method to rollback the connection.- Specified by:
rollbackin interfaceConnection- Throws:
SQLException- thrown if an error occurs.
-
getAutoCommit
Accessor for the autocommit setting.- Specified by:
getAutoCommitin interfaceConnection- Returns:
- Whether to autocommit
- Throws:
SQLException- thrown if an error occurs.
-
isClosed
Accessor for whether the connection is closed.- Specified by:
isClosedin interfaceConnection- Returns:
- Whether it is closed.
- Throws:
SQLException- thrown if an error occurs.
-
isReadOnly
Accessor for whether the connection is read only.- Specified by:
isReadOnlyin interfaceConnection- Returns:
- Whether it is read only.
- Throws:
SQLException- thrown if an error occurs.
-
setHoldability
Method to set the holdability for the connection.- Specified by:
setHoldabilityin interfaceConnection- Parameters:
holdability- The holdability- Throws:
SQLException- thrown if an error occurs.
-
setTransactionIsolation
Method to set the transaction isolation for the connection.- Specified by:
setTransactionIsolationin interfaceConnection- Parameters:
level- The transaction isolation- Throws:
SQLException- thrown if an error occurs.
-
setAutoCommit
Method to set the autocommit for the connection.- Specified by:
setAutoCommitin interfaceConnection- Parameters:
autoCommit- Whether to autocommit- Throws:
SQLException- thrown if an error occurs.
-
setReadOnly
Method to set the read-only nature for the connection.- Specified by:
setReadOnlyin interfaceConnection- Parameters:
readOnly- whether it is read-only- Throws:
SQLException- thrown if an error occurs.
-
getCatalog
Accessor for the catalog.- Specified by:
getCatalogin interfaceConnection- Returns:
- The catalog
- Throws:
SQLException- Thrown if an error occurs
-
setCatalog
Mutator for the catalog- Specified by:
setCatalogin interfaceConnection- Parameters:
catalog- The catalog- Throws:
SQLException- Thrown if an error occurs
-
getMetaData
Accessor for the database metadata.- Specified by:
getMetaDatain interfaceConnection- Returns:
- The database metadata
- Throws:
SQLException- Thrown if an error occurs
-
getWarnings
Accessor for the warnings.- Specified by:
getWarningsin interfaceConnection- Returns:
- The warnings
- Throws:
SQLException- Thrown if an error occurs
-
setSavepoint
Mutator to set the savepoint.- Specified by:
setSavepointin interfaceConnection- Returns:
- The savepoint
- Throws:
SQLException- Thrown if an error occurs
-
releaseSavepoint
Mutator to release the savepoint.- Specified by:
releaseSavepointin interfaceConnection- Parameters:
pt- The savepoint- Throws:
SQLException- Thrown if an error occurs
-
rollback
Mutator to rollback the savepoint.- Specified by:
rollbackin interfaceConnection- Parameters:
pt- The savepoint- Throws:
SQLException- Thrown if an error occurs
-
createStatement
Accessor for a statement.- Specified by:
createStatementin interfaceConnection- Returns:
- The statement
- Throws:
SQLException- Thrown if an error occurs
-
createStatement
Accessor for a statement.- Specified by:
createStatementin interfaceConnection- Parameters:
resultSetType- type of resultsresultSetConcurrency- The concurrency- Returns:
- The statement
- Throws:
SQLException- Thrown if an error occurs
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException Accessor for a statement.- Specified by:
createStatementin interfaceConnection- Parameters:
resultSetType- type of resultsresultSetConcurrency- The concurrencyresultSetHoldability- The holdability- Returns:
- The statement
- Throws:
SQLException- Thrown if an error occurs
-
getTypeMap
Accessor for the type map.- Specified by:
getTypeMapin interfaceConnection- Returns:
- The type map
- Throws:
SQLException- Thrown if an error occurs
-
setTypeMap
Method to set the type map- Specified by:
setTypeMapin interfaceConnection- Parameters:
map- The type map- Throws:
SQLException- Thrown if an error occurs
-
nativeSQL
Accessor for using native SQL.- Specified by:
nativeSQLin interfaceConnection- Parameters:
sql- The sql- Returns:
- The native SQL
- Throws:
SQLException- Thrown if an error occurs
-
prepareCall
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String arg0, int arg1, int arg2, int arg3) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
assertAvailable
public void assertAvailable()Assert the JDOConnection is available. Throws a JDOException if not available -
createArrayOf
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createBlob
- Specified by:
createBlobin interfaceConnection- Throws:
SQLException
-
createClob
- Specified by:
createClobin interfaceConnection- Throws:
SQLException
-
createStruct
- Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
isValid
- Specified by:
isValidin interfaceConnection- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
createNClob
- Specified by:
createNClobin interfaceConnection- Throws:
SQLException
-
createSQLXML
- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
setSchema
- Specified by:
setSchemain interfaceConnection- Throws:
SQLException
-
getSchema
- Specified by:
getSchemain interfaceConnection- Throws:
SQLException
-
abort
- Specified by:
abortin interfaceConnection- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeoutin interfaceConnection- Throws:
SQLException
-