Package org.datanucleus.api.jdo
Class JDOConnectionJDBCImpl
- java.lang.Object
-
- org.datanucleus.api.jdo.JDOConnectionImpl
-
- org.datanucleus.api.jdo.JDOConnectionJDBCImpl
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.Connection,java.sql.Wrapper,javax.jdo.datastore.JDOConnection
public class JDOConnectionJDBCImpl extends JDOConnectionImpl implements java.sql.Connection
Implementation of a JDO connection that is also a wrapper for "java.sql.Connection".
-
-
Field Summary
Fields Modifier and Type Field Description private java.sql.ConnectionconnThe JDBC connection (shortcut for the native connection of the NucleusConnection).private booleanisAvailablewhether this connection is available to the developer-
Fields inherited from class org.datanucleus.api.jdo.JDOConnectionImpl
nucConn
-
-
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(java.util.concurrent.Executor executor)voidassertAvailable()Assert the JDOConnection is available.voidclearWarnings()Method to clear warnings from the connection.voidcommit()Method to commit the connection.java.sql.ArraycreateArrayOf(java.lang.String typeName, java.lang.Object[] elements)java.sql.BlobcreateBlob()java.sql.ClobcreateClob()java.sql.NClobcreateNClob()java.sql.SQLXMLcreateSQLXML()java.sql.StatementcreateStatement()Accessor for a statement.java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency)Accessor for a statement.java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)Accessor for a statement.java.sql.StructcreateStruct(java.lang.String typeName, java.lang.Object[] attributes)booleangetAutoCommit()Accessor for the autocommit setting.java.lang.StringgetCatalog()Accessor for the catalog.java.util.PropertiesgetClientInfo()java.lang.StringgetClientInfo(java.lang.String name)intgetHoldability()Access the holdability of the connection.java.sql.DatabaseMetaDatagetMetaData()Accessor for the database metadata.intgetNetworkTimeout()java.lang.StringgetSchema()intgetTransactionIsolation()Accessor for the transaction isolation level.java.util.Map<java.lang.String,java.lang.Class<?>>getTypeMap()Accessor for the type map.java.sql.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(java.lang.Class iface)java.lang.StringnativeSQL(java.lang.String sql)Accessor for using native SQL.java.sql.CallableStatementprepareCall(java.lang.String sql)java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)java.sql.CallableStatementprepareCall(java.lang.String arg0, int arg1, int arg2, int arg3)java.sql.PreparedStatementprepareStatement(java.lang.String sql)java.sql.PreparedStatementprepareStatement(java.lang.String arg0, int arg1)java.sql.PreparedStatementprepareStatement(java.lang.String arg0, int[] arg1)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)java.sql.PreparedStatementprepareStatement(java.lang.String arg0, int arg1, int arg2, int arg3)java.sql.PreparedStatementprepareStatement(java.lang.String arg0, java.lang.String[] arg1)voidreleaseSavepoint(java.sql.Savepoint pt)Mutator to release the savepoint.voidrollback()Method to rollback the connection.voidrollback(java.sql.Savepoint pt)Mutator to rollback the savepoint.voidsetAutoCommit(boolean autoCommit)Method to set the autocommit for the connection.voidsetCatalog(java.lang.String catalog)Mutator for the catalogvoidsetClientInfo(java.lang.String name, java.lang.String value)voidsetClientInfo(java.util.Properties properties)voidsetHoldability(int holdability)Method to set the holdability for the connection.voidsetNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds)voidsetReadOnly(boolean readOnly)Method to set the read-only nature for the connection.java.sql.SavepointsetSavepoint()Mutator to set the savepoint.java.sql.SavepointsetSavepoint(java.lang.String arg0)voidsetSchema(java.lang.String schema)voidsetTransactionIsolation(int level)Method to set the transaction isolation for the connection.voidsetTypeMap(java.util.Map map)Method to set the type map<T> Tunwrap(java.lang.Class<T> iface)-
Methods inherited from class org.datanucleus.api.jdo.JDOConnectionImpl
close, getNativeConnection, throwExceptionNotAvailable, throwExceptionUnsupportedOperation
-
-
-
-
Method Detail
-
isAvailable
public boolean isAvailable()
-
getHoldability
public int getHoldability() throws java.sql.SQLExceptionAccess the holdability of the connection.- Specified by:
getHoldabilityin interfacejava.sql.Connection- Returns:
- The holdability
- Throws:
java.sql.SQLException- if there is a problem
-
getTransactionIsolation
public int getTransactionIsolation() throws java.sql.SQLExceptionAccessor for the transaction isolation level.- Specified by:
getTransactionIsolationin interfacejava.sql.Connection- Returns:
- The isolation level
- Throws:
java.sql.SQLException- if there is a problem
-
clearWarnings
public void clearWarnings() throws java.sql.SQLExceptionMethod to clear warnings from the connection.- Specified by:
clearWarningsin interfacejava.sql.Connection- Throws:
java.sql.SQLException- thrown if there is a problem
-
commit
public void commit() throws java.sql.SQLExceptionMethod to commit the connection.- Specified by:
commitin interfacejava.sql.Connection- Throws:
java.sql.SQLException- thrown if an error occurs.
-
rollback
public void rollback() throws java.sql.SQLExceptionMethod to rollback the connection.- Specified by:
rollbackin interfacejava.sql.Connection- Throws:
java.sql.SQLException- thrown if an error occurs.
-
getAutoCommit
public boolean getAutoCommit() throws java.sql.SQLExceptionAccessor for the autocommit setting.- Specified by:
getAutoCommitin interfacejava.sql.Connection- Returns:
- Whether to autocommit
- Throws:
java.sql.SQLException- thrown if an error occurs.
-
isClosed
public boolean isClosed() throws java.sql.SQLExceptionAccessor for whether the connection is closed.- Specified by:
isClosedin interfacejava.sql.Connection- Returns:
- Whether it is closed.
- Throws:
java.sql.SQLException- thrown if an error occurs.
-
isReadOnly
public boolean isReadOnly() throws java.sql.SQLExceptionAccessor for whether the connection is read only.- Specified by:
isReadOnlyin interfacejava.sql.Connection- Returns:
- Whether it is read only.
- Throws:
java.sql.SQLException- thrown if an error occurs.
-
setHoldability
public void setHoldability(int holdability) throws java.sql.SQLExceptionMethod to set the holdability for the connection.- Specified by:
setHoldabilityin interfacejava.sql.Connection- Parameters:
holdability- The holdability- Throws:
java.sql.SQLException- thrown if an error occurs.
-
setTransactionIsolation
public void setTransactionIsolation(int level) throws java.sql.SQLExceptionMethod to set the transaction isolation for the connection.- Specified by:
setTransactionIsolationin interfacejava.sql.Connection- Parameters:
level- The transaction isolation- Throws:
java.sql.SQLException- thrown if an error occurs.
-
setAutoCommit
public void setAutoCommit(boolean autoCommit) throws java.sql.SQLExceptionMethod to set the autocommit for the connection.- Specified by:
setAutoCommitin interfacejava.sql.Connection- Parameters:
autoCommit- Whether to autocommit- Throws:
java.sql.SQLException- thrown if an error occurs.
-
setReadOnly
public void setReadOnly(boolean readOnly) throws java.sql.SQLExceptionMethod to set the read-only nature for the connection.- Specified by:
setReadOnlyin interfacejava.sql.Connection- Parameters:
readOnly- whether it is read-only- Throws:
java.sql.SQLException- thrown if an error occurs.
-
getCatalog
public java.lang.String getCatalog() throws java.sql.SQLExceptionAccessor for the catalog.- Specified by:
getCatalogin interfacejava.sql.Connection- Returns:
- The catalog
- Throws:
java.sql.SQLException- Thrown if an error occurs
-
setCatalog
public void setCatalog(java.lang.String catalog) throws java.sql.SQLExceptionMutator for the catalog- Specified by:
setCatalogin interfacejava.sql.Connection- Parameters:
catalog- The catalog- Throws:
java.sql.SQLException- Thrown if an error occurs
-
getMetaData
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLExceptionAccessor for the database metadata.- Specified by:
getMetaDatain interfacejava.sql.Connection- Returns:
- The database metadata
- Throws:
java.sql.SQLException- Thrown if an error occurs
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLExceptionAccessor for the warnings.- Specified by:
getWarningsin interfacejava.sql.Connection- Returns:
- The warnings
- Throws:
java.sql.SQLException- Thrown if an error occurs
-
setSavepoint
public java.sql.Savepoint setSavepoint() throws java.sql.SQLExceptionMutator to set the savepoint.- Specified by:
setSavepointin interfacejava.sql.Connection- Returns:
- The savepoint
- Throws:
java.sql.SQLException- Thrown if an error occurs
-
releaseSavepoint
public void releaseSavepoint(java.sql.Savepoint pt) throws java.sql.SQLExceptionMutator to release the savepoint.- Specified by:
releaseSavepointin interfacejava.sql.Connection- Parameters:
pt- The savepoint- Throws:
java.sql.SQLException- Thrown if an error occurs
-
rollback
public void rollback(java.sql.Savepoint pt) throws java.sql.SQLExceptionMutator to rollback the savepoint.- Specified by:
rollbackin interfacejava.sql.Connection- Parameters:
pt- The savepoint- Throws:
java.sql.SQLException- Thrown if an error occurs
-
createStatement
public java.sql.Statement createStatement() throws java.sql.SQLExceptionAccessor for a statement.- Specified by:
createStatementin interfacejava.sql.Connection- Returns:
- The statement
- Throws:
java.sql.SQLException- Thrown if an error occurs
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLExceptionAccessor for a statement.- Specified by:
createStatementin interfacejava.sql.Connection- Parameters:
resultSetType- type of resultsresultSetConcurrency- The concurrency- Returns:
- The statement
- Throws:
java.sql.SQLException- Thrown if an error occurs
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLExceptionAccessor for a statement.- Specified by:
createStatementin interfacejava.sql.Connection- Parameters:
resultSetType- type of resultsresultSetConcurrency- The concurrencyresultSetHoldability- The holdability- Returns:
- The statement
- Throws:
java.sql.SQLException- Thrown if an error occurs
-
getTypeMap
public java.util.Map<java.lang.String,java.lang.Class<?>> getTypeMap() throws java.sql.SQLExceptionAccessor for the type map.- Specified by:
getTypeMapin interfacejava.sql.Connection- Returns:
- The type map
- Throws:
java.sql.SQLException- Thrown if an error occurs
-
setTypeMap
public void setTypeMap(java.util.Map map) throws java.sql.SQLExceptionMethod to set the type map- Specified by:
setTypeMapin interfacejava.sql.Connection- Parameters:
map- The type map- Throws:
java.sql.SQLException- Thrown if an error occurs
-
nativeSQL
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLExceptionAccessor for using native SQL.- Specified by:
nativeSQLin interfacejava.sql.Connection- Parameters:
sql- The sql- Returns:
- The native SQL
- Throws:
java.sql.SQLException- Thrown if an error occurs
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String arg0, int arg1, int arg2, int arg3) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String arg0, int arg1) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String arg0, int arg1, int arg2, int arg3) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String arg0, int[] arg1) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setSavepoint
public java.sql.Savepoint setSavepoint(java.lang.String arg0) throws java.sql.SQLException- Specified by:
setSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String arg0, java.lang.String[] arg1) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
assertAvailable
public void assertAvailable()
Assert the JDOConnection is available. Throws a JDOException if not available
-
createArrayOf
public java.sql.Array createArrayOf(java.lang.String typeName, java.lang.Object[] elements) throws java.sql.SQLException- Specified by:
createArrayOfin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createBlob
public java.sql.Blob createBlob() throws java.sql.SQLException- Specified by:
createBlobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createClob
public java.sql.Clob createClob() throws java.sql.SQLException- Specified by:
createClobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStruct
public java.sql.Struct createStruct(java.lang.String typeName, java.lang.Object[] attributes) throws java.sql.SQLException- Specified by:
createStructin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getClientInfo
public java.util.Properties getClientInfo() throws java.sql.SQLException- Specified by:
getClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getClientInfo
public java.lang.String getClientInfo(java.lang.String name) throws java.sql.SQLException- Specified by:
getClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
isValid
public boolean isValid(int timeout) throws java.sql.SQLException- Specified by:
isValidin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setClientInfo
public void setClientInfo(java.util.Properties properties) throws java.sql.SQLClientInfoException- Specified by:
setClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLClientInfoException
-
setClientInfo
public void setClientInfo(java.lang.String name, java.lang.String value) throws java.sql.SQLClientInfoException- Specified by:
setClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLClientInfoException
-
createNClob
public java.sql.NClob createNClob() throws java.sql.SQLException- Specified by:
createNClobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createSQLXML
public java.sql.SQLXML createSQLXML() throws java.sql.SQLException- Specified by:
createSQLXMLin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class iface) throws java.sql.SQLException- Specified by:
isWrapperForin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException- Specified by:
unwrapin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
setSchema
public void setSchema(java.lang.String schema) throws java.sql.SQLException- Specified by:
setSchemain interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getSchema
public java.lang.String getSchema() throws java.sql.SQLException- Specified by:
getSchemain interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
abort
public void abort(java.util.concurrent.Executor executor) throws java.sql.SQLException- Specified by:
abortin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setNetworkTimeout
public void setNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds) throws java.sql.SQLException- Specified by:
setNetworkTimeoutin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getNetworkTimeout
public int getNetworkTimeout() throws java.sql.SQLException- Specified by:
getNetworkTimeoutin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
-