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
public class JDOConnectionJDBCImpl extends JDOConnectionImpl implements Connection
Implementation of a JDO connection that is also a wrapper for "java.sql.Connection".
-
-
Field Summary
-
Fields inherited from class org.datanucleus.api.jdo.JDOConnectionImpl
nucConn
-
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
-
Constructor Summary
Constructors Constructor Description JDOConnectionJDBCImpl(org.datanucleus.store.NucleusConnection nconn)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(Executor executor)voidassertAvailable()Assert the JDOConnection is available.voidclearWarnings()Method to clear warnings from the connection.voidcommit()Method to commit the connection.ArraycreateArrayOf(String typeName, Object[] elements)BlobcreateBlob()ClobcreateClob()NClobcreateNClob()SQLXMLcreateSQLXML()StatementcreateStatement()Accessor for a statement.StatementcreateStatement(int resultSetType, int resultSetConcurrency)Accessor for a statement.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)Accessor for a statement.StructcreateStruct(String typeName, Object[] attributes)booleangetAutoCommit()Accessor for the autocommit setting.StringgetCatalog()Accessor for the catalog.PropertiesgetClientInfo()StringgetClientInfo(String name)intgetHoldability()Access the holdability of the connection.DatabaseMetaDatagetMetaData()Accessor for the database metadata.intgetNetworkTimeout()StringgetSchema()intgetTransactionIsolation()Accessor for the transaction isolation level.MapgetTypeMap()Accessor for the type map.SQLWarninggetWarnings()Accessor for the warnings.booleanisAvailable()booleanisClosed()Accessor for whether the connection is closed.booleanisReadOnly()Accessor for whether the connection is read only.booleanisValid(int timeout)booleanisWrapperFor(Class iface)StringnativeSQL(String sql)Accessor for using native SQL.CallableStatementprepareCall(String sql)CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency)CallableStatementprepareCall(String arg0, int arg1, int arg2, int arg3)PreparedStatementprepareStatement(String sql)PreparedStatementprepareStatement(String arg0, int arg1)PreparedStatementprepareStatement(String arg0, int[] arg1)PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency)PreparedStatementprepareStatement(String arg0, int arg1, int arg2, int arg3)PreparedStatementprepareStatement(String arg0, String[] arg1)voidreleaseSavepoint(Savepoint pt)Mutator to release the savepoint.voidrollback()Method to rollback the connection.voidrollback(Savepoint pt)Mutator 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.SavepointsetSavepoint()Mutator to set the savepoint.SavepointsetSavepoint(String arg0)voidsetSchema(String schema)voidsetTransactionIsolation(int level)Method to set the transaction isolation for the connection.voidsetTypeMap(Map map)Method to set the type mapObjectunwrap(Class iface)-
Methods inherited from class org.datanucleus.api.jdo.JDOConnectionImpl
close, getNativeConnection, throwExceptionNotAvailable, throwExceptionUnsupportedOperation
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.Connection
beginRequest, close, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
-
-
-
Method Detail
-
isAvailable
public boolean isAvailable()
-
getHoldability
public int getHoldability() throws SQLExceptionAccess the holdability of the connection.- Specified by:
getHoldabilityin interfaceConnection- Returns:
- The holdability
- Throws:
SQLException- if there is a problem
-
getTransactionIsolation
public int getTransactionIsolation() throws SQLExceptionAccessor for the transaction isolation level.- Specified by:
getTransactionIsolationin interfaceConnection- Returns:
- The isolation level
- Throws:
SQLException- if there is a problem
-
clearWarnings
public void clearWarnings() throws SQLExceptionMethod to clear warnings from the connection.- Specified by:
clearWarningsin interfaceConnection- Throws:
SQLException- thrown if there is a problem
-
commit
public void commit() throws SQLExceptionMethod to commit the connection.- Specified by:
commitin interfaceConnection- Throws:
SQLException- thrown if an error occurs.
-
rollback
public void rollback() throws SQLExceptionMethod to rollback the connection.- Specified by:
rollbackin interfaceConnection- Throws:
SQLException- thrown if an error occurs.
-
getAutoCommit
public boolean getAutoCommit() throws SQLExceptionAccessor for the autocommit setting.- Specified by:
getAutoCommitin interfaceConnection- Returns:
- Whether to autocommit
- Throws:
SQLException- thrown if an error occurs.
-
isClosed
public boolean isClosed() throws SQLExceptionAccessor for whether the connection is closed.- Specified by:
isClosedin interfaceConnection- Returns:
- Whether it is closed.
- Throws:
SQLException- thrown if an error occurs.
-
isReadOnly
public boolean isReadOnly() throws SQLExceptionAccessor 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
public void setHoldability(int holdability) throws SQLExceptionMethod to set the holdability for the connection.- Specified by:
setHoldabilityin interfaceConnection- Parameters:
holdability- The holdability- Throws:
SQLException- thrown if an error occurs.
-
setTransactionIsolation
public void setTransactionIsolation(int level) throws SQLExceptionMethod 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
public void setAutoCommit(boolean autoCommit) throws SQLExceptionMethod to set the autocommit for the connection.- Specified by:
setAutoCommitin interfaceConnection- Parameters:
autoCommit- Whether to autocommit- Throws:
SQLException- thrown if an error occurs.
-
setReadOnly
public void setReadOnly(boolean readOnly) throws SQLExceptionMethod 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
public String getCatalog() throws SQLException
Accessor for the catalog.- Specified by:
getCatalogin interfaceConnection- Returns:
- The catalog
- Throws:
SQLException- Thrown if an error occurs
-
setCatalog
public void setCatalog(String catalog) throws SQLException
Mutator for the catalog- Specified by:
setCatalogin interfaceConnection- Parameters:
catalog- The catalog- Throws:
SQLException- Thrown if an error occurs
-
getMetaData
public DatabaseMetaData getMetaData() throws SQLException
Accessor for the database metadata.- Specified by:
getMetaDatain interfaceConnection- Returns:
- The database metadata
- Throws:
SQLException- Thrown if an error occurs
-
getWarnings
public SQLWarning getWarnings() throws SQLException
Accessor for the warnings.- Specified by:
getWarningsin interfaceConnection- Returns:
- The warnings
- Throws:
SQLException- Thrown if an error occurs
-
setSavepoint
public Savepoint setSavepoint() throws SQLException
Mutator to set the savepoint.- Specified by:
setSavepointin interfaceConnection- Returns:
- The savepoint
- Throws:
SQLException- Thrown if an error occurs
-
releaseSavepoint
public void releaseSavepoint(Savepoint pt) throws SQLException
Mutator to release the savepoint.- Specified by:
releaseSavepointin interfaceConnection- Parameters:
pt- The savepoint- Throws:
SQLException- Thrown if an error occurs
-
rollback
public void rollback(Savepoint pt) throws SQLException
Mutator to rollback the savepoint.- Specified by:
rollbackin interfaceConnection- Parameters:
pt- The savepoint- Throws:
SQLException- Thrown if an error occurs
-
createStatement
public Statement createStatement() throws SQLException
Accessor for a statement.- Specified by:
createStatementin interfaceConnection- Returns:
- The statement
- Throws:
SQLException- Thrown if an error occurs
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
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
public Map getTypeMap() throws SQLException
Accessor for the type map.- Specified by:
getTypeMapin interfaceConnection- Returns:
- The type map
- Throws:
SQLException- Thrown if an error occurs
-
setTypeMap
public void setTypeMap(Map map) throws SQLException
Method to set the type map- Specified by:
setTypeMapin interfaceConnection- Parameters:
map- The type map- Throws:
SQLException- Thrown if an error occurs
-
nativeSQL
public String nativeSQL(String sql) throws SQLException
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
public CallableStatement prepareCall(String sql) throws SQLException
- 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
public CallableStatement prepareCall(String arg0, int arg1, int arg2, int arg3) throws SQLException
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String arg0, int arg1) throws SQLException
- 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
public PreparedStatement prepareStatement(String arg0, int[] arg1) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
setSavepoint
public Savepoint setSavepoint(String arg0) throws SQLException
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String arg0, String[] arg1) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
assertAvailable
public void assertAvailable()
Assert the JDOConnection is available. Throws a JDOException if not available
-
createArrayOf
public Array createArrayOf(String typeName, Object[] elements) throws SQLException
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createBlob
public Blob createBlob() throws SQLException
- Specified by:
createBlobin interfaceConnection- Throws:
SQLException
-
createClob
public Clob createClob() throws SQLException
- Specified by:
createClobin interfaceConnection- Throws:
SQLException
-
createStruct
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
- Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
getClientInfo
public Properties getClientInfo() throws SQLException
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
getClientInfo
public String getClientInfo(String name) throws SQLException
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
isValid
public boolean isValid(int timeout) throws SQLException- Specified by:
isValidin interfaceConnection- Throws:
SQLException
-
setClientInfo
public void setClientInfo(Properties properties) throws SQLClientInfoException
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
setClientInfo
public void setClientInfo(String name, String value) throws SQLClientInfoException
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
createNClob
public NClob createNClob() throws SQLException
- Specified by:
createNClobin interfaceConnection- Throws:
SQLException
-
createSQLXML
public SQLXML createSQLXML() throws SQLException
- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class iface) throws SQLException
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
unwrap
public Object unwrap(Class iface) throws SQLException
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
setSchema
public void setSchema(String schema) throws SQLException
- Specified by:
setSchemain interfaceConnection- Throws:
SQLException
-
getSchema
public String getSchema() throws SQLException
- Specified by:
getSchemain interfaceConnection- Throws:
SQLException
-
abort
public void abort(Executor executor) throws SQLException
- Specified by:
abortin interfaceConnection- Throws:
SQLException
-
setNetworkTimeout
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException
- Specified by:
setNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
getNetworkTimeout
public int getNetworkTimeout() throws SQLException- Specified by:
getNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
-