Class JDBCConnection
- All Implemented Interfaces:
AutoCloseable,Connection,Wrapper,BusyHandler
public class JDBCConnection extends Object implements Connection, BusyHandler
-
Field Summary
Fields Modifier and Type Field Description protected booleanautocommitAutocommit flag, true means autocommit.protected SQLite.JDBC2z.DatabaseXdbOpen database.protected StringencCharacter encoding.protected booleanintransIn-transaction flag.protected inttimeoutTimeout for Database.exec()protected StringurlDatabase URL.protected booleanuseJulianUse double/julian date representation.protected StringvfsSQLite 3 VFS to use.Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE -
Constructor Summary
-
Method Summary
Modifier and Type Method Description booleanbusy(String table, int count)Invoked when a table is locked by another process or thread.protected booleanbusy3(SQLite.JDBC2z.DatabaseX db, int count)voidclearWarnings()Discards all warnings that may have arisen for this connection.voidclose()Causes the instant release of all database and driver connection resources associated with this object.voidcommit()Commits all of the changes made since the lastcommitorrollbackof the associated transaction.ArraycreateArrayOf(String type, Object[] elems)Returns a newArraycontaining the givenelements.BlobcreateBlob()Returns a new empty Blob.ClobcreateClob()Returns a new empty Clob.NClobcreateNClob()Returns a new empty NClob.SQLXMLcreateSQLXML()Returns a new empty SQLXML.StatementcreateStatement()Returns a new instance ofStatementfor issuing SQL commands to the remote database.StatementcreateStatement(int resultSetType, int resultSetConcurrency)Returns a new instance ofStatementwhose associatedResultSets have the characteristics specified in the type and concurrency arguments.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)Returns a new instance ofStatementwhose associatedResultSets will have the characteristics specified in the type, concurrency and holdability arguments.StructcreateStruct(String type, Object[] attrs)Returns a newStructcontaining the givenattributes.booleangetAutoCommit()Returns abooleanindicating whether or not this connection is in theauto-commitoperating mode.StringgetCatalog()Gets thisConnectionobject's current catalog name.PropertiesgetClientInfo()Returns aPropertiesobject containing all client info properties.StringgetClientInfo(String name)Returns the value corresponding to the given client info property, or null if unset.intgetHoldability()Returns the holdability property that anyResultSetproduced by this instance will have.DatabaseMetaDatagetMetaData()Gets the metadata about the database referenced by this connection.DatabasegetSQLiteDatabase()intgetTransactionIsolation()Returns the transaction isolation level for this connection.Map<String,Class<?>>getTypeMap()Returns the type mapping associated with thisConnectionobject.SQLWarninggetWarnings()Gets the first instance of anySQLWarningobjects that may have been created in the use of this connection.booleanisClosed()Returns abooleanindicating whether or not this connection is in theclosedstate.booleanisReadOnly()Returns abooleanindicating whether or not this connection is currently in theread-onlystate.booleanisValid(int timeout)Returns true if this connection is still open and valid, false otherwise.booleanisWrapperFor(Class iface)If the caller is a wrapper of the class or implements the given interface, the methods return false and vice versa.StringnativeSQL(String sql)Returns a string representation of the input SQL statementsqlexpressed in the underlying system's native SQL syntax.CallableStatementprepareCall(String sql)Returns a new instance ofCallableStatementthat may be used for making stored procedure calls to the database.CallableStatementprepareCall(String sql, int x, int y)Returns a new instance ofCallableStatementthat may be used for making stored procedure calls to the database.CallableStatementprepareCall(String sql, int x, int y, int z)Returns a new instance ofCallableStatementthat may be used for making stored procedure calls to the database.PreparedStatementprepareStatement(String sql)Returns a new instance ofPreparedStatementthat may be used any number of times to execute parameterized requests on the database server.PreparedStatementprepareStatement(String sql, int autokeys)Creates a defaultPreparedStatementthat can retrieve automatically generated keys.PreparedStatementprepareStatement(String sql, int[] colIndexes)Creates a defaultPreparedStatementthat can retrieve the auto-generated keys designated by a supplied array.PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency)Creates aPreparedStatementthat generatesResultSets with the specified values ofresultSetTypeandresultSetConcurrency.PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)Creates aPreparedStatementthat generatesResultSets with the specified type, concurrency and holdabilityPreparedStatementprepareStatement(String sql, String[] columns)Creates a defaultPreparedStatementthat can retrieve the auto-generated keys designated by a supplied array.voidreleaseSavepoint(Savepoint x)Releases the specifiedsavepointfrom the present transaction.voidrollback()Rolls back all updates made so far in this transaction and relinquishes all acquired database locks.voidrollback(Savepoint x)Undoes all changes made after the suppliedSavepointobject was set.voidsetAutoCommit(boolean ac)Sets this connection's auto-commit modeonoroff.voidsetCatalog(String catalog)Sets the catalog name for this connection.voidsetClientInfo(String name, String value)Sets the client info propertynametovalue.voidsetClientInfo(Properties prop)Replaces all client info properties with the name/value pairs fromproperties.voidsetHoldability(int holdability)Sets the holdability of theResultSets created by this Connection.voidsetReadOnly(boolean ro)Sets this connection to read-only mode.SavepointsetSavepoint()Creates an unnamedSavepointin the current transaction.SavepointsetSavepoint(String name)Creates a namedSavepointin the current transaction.voidsetTransactionIsolation(int level)Sets the transaction isolation level for this Connection.voidsetTypeMap(Map map)Sets theTypeMapfor this connection.<T> Tunwrap(Class<T> iface)Returns an object that implements the given interface.
-
Field Details
-
db
protected SQLite.JDBC2z.DatabaseX dbOpen database. -
url
Database URL. -
enc
Character encoding. -
vfs
SQLite 3 VFS to use. -
autocommit
protected boolean autocommitAutocommit flag, true means autocommit. -
intrans
protected boolean intransIn-transaction flag. Can be true only when autocommit false. -
timeout
protected int timeoutTimeout for Database.exec() -
useJulian
protected boolean useJulianUse double/julian date representation.
-
-
Constructor Details
-
JDBCConnection
public JDBCConnection(String url, String enc, String pwd, String drep, String vfs) throws SQLException- Throws:
SQLException
-
-
Method Details
-
busy
Description copied from interface:BusyHandlerInvoked when a table is locked by another process or thread. The method should return true for waiting until the table becomes unlocked, or false in order to abandon the action.- Specified by:
busyin interfaceBusyHandler- Parameters:
table- the name of the locked tablecount- number of times the table was locked
-
busy3
protected boolean busy3(SQLite.JDBC2z.DatabaseX db, int count) -
getSQLiteDatabase
-
createStatement
Description copied from interface:ConnectionReturns a new instance ofStatementfor issuing SQL commands to the remote database.ResultSetsgenerated by the returned statement will default to typeResultSet.TYPE_FORWARD_ONLYand concurrency levelResultSet.CONCUR_READ_ONLY.- Specified by:
createStatementin interfaceConnection- Returns:
- a
Statementobject with default settings. - See Also:
ResultSet
-
createStatement
Description copied from interface:ConnectionReturns a new instance ofStatementwhose associatedResultSets have the characteristics specified in the type and concurrency arguments.- Specified by:
createStatementin interfaceConnection- Parameters:
resultSetType- one of the following type specifiers:resultSetConcurrency- one of the following concurrency mode specifiers:- Returns:
- a new instance of
Statementcapable of manufacturingResultSets that satisfy the specifiedresultSetTypeandresultSetConcurrencyvalues. - Throws:
SQLException- if there is a problem accessing the database
-
getMetaData
Description copied from interface:ConnectionGets the metadata about the database referenced by this connection. The returnedDatabaseMetaDatadescribes the database topography, available stored procedures, SQL syntax and so on.- Specified by:
getMetaDatain interfaceConnection- Returns:
- a
DatabaseMetaDataobject containing the database description. - Throws:
SQLException- if there is a problem accessing the a database.
-
close
Description copied from interface:ConnectionCauses the instant release of all database and driver connection resources associated with this object. Any subsequent invocations of this method have no effect.It is strongly recommended that all connections are closed before they are dereferenced by the application ready for garbage collection. Although the
finalizemethod of the connection closes the connection before garbage collection takes place, it is not advisable to leave thecloseoperation to take place in this way. Mainly because undesired side-effects may appear.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnection- Throws:
SQLException- if there is a problem accessing the database.
-
isClosed
Description copied from interface:ConnectionReturns abooleanindicating whether or not this connection is in theclosedstate. Theclosedstate may be entered into as a consequence of a successful invocation of theConnection.close()method or else if an error has occurred that prevents the connection from functioning normally.- Specified by:
isClosedin interfaceConnection- Returns:
trueif closed, otherwisefalse.- Throws:
SQLException- if there is a problem accessing the database.
-
isReadOnly
Description copied from interface:ConnectionReturns abooleanindicating whether or not this connection is currently in theread-onlystate.- Specified by:
isReadOnlyin interfaceConnection- Returns:
trueif in read-only state, otherwisefalse.- Throws:
SQLException- if there is a problem accessing the database.
-
clearWarnings
Description copied from interface:ConnectionDiscards all warnings that may have arisen for this connection. Subsequent calls toConnection.getWarnings()will returnnullup until a new warning condition occurs.- Specified by:
clearWarningsin interfaceConnection- Throws:
SQLException- if there is a problem accessing the database.
-
commit
Description copied from interface:ConnectionCommits all of the changes made since the lastcommitorrollbackof the associated transaction. All locks in the database held by this connection are also relinquished. Calling this operation on connection objects inauto-commitmode leads to an error.- Specified by:
commitin interfaceConnection- Throws:
SQLException- if there is a problem accessing the database or if the target connection instance is in auto-commit mode.
-
getAutoCommit
Description copied from interface:ConnectionReturns abooleanindicating whether or not this connection is in theauto-commitoperating mode.- Specified by:
getAutoCommitin interfaceConnection- Returns:
trueifauto-commitis on, otherwisefalse.- Throws:
SQLException- if there is a problem accessing the database.
-
getCatalog
Description copied from interface:ConnectionGets thisConnectionobject's current catalog name.- Specified by:
getCatalogin interfaceConnection- Returns:
- the catalog name.
nullif there is no catalog name. - Throws:
SQLException- if there is a problem accessing the database.
-
getTransactionIsolation
Description copied from interface:ConnectionReturns the transaction isolation level for this connection.- Specified by:
getTransactionIsolationin interfaceConnection- Returns:
- the transaction isolation value.
- Throws:
SQLException- if there is a problem accessing the database.- See Also:
Connection.TRANSACTION_NONE,Connection.TRANSACTION_READ_COMMITTED,Connection.TRANSACTION_READ_UNCOMMITTED,Connection.TRANSACTION_REPEATABLE_READ,Connection.TRANSACTION_SERIALIZABLE
-
getWarnings
Description copied from interface:ConnectionGets the first instance of anySQLWarningobjects that may have been created in the use of this connection. If at least one warning has occurred then this operation returns the first one reported. Anullindicates that no warnings have occurred.By invoking the
SQLWarning.getNextWarning()method of the returnedSQLWarningobject it is possible to obtain all of this connection's warning objects.- Specified by:
getWarningsin interfaceConnection- Returns:
- the first warning as an SQLWarning object (may be
null). - Throws:
SQLException- if there is a problem accessing the database or if the call has been made on a connection which has been previously closed.
-
nativeSQL
Description copied from interface:ConnectionReturns a string representation of the input SQL statementsqlexpressed in the underlying system's native SQL syntax.- Specified by:
nativeSQLin interfaceConnection- Parameters:
sql- the JDBC form of an SQL statement.- Returns:
- the SQL statement in native database format.
- Throws:
SQLException- if there is a problem accessing the database
-
prepareCall
Description copied from interface:ConnectionReturns a new instance ofCallableStatementthat may be used for making stored procedure calls to the database.- Specified by:
prepareCallin interfaceConnection- Parameters:
sql- the SQL statement that calls the stored function- Returns:
- a new instance of
CallableStatementrepresenting the SQL statement.ResultSets emitted from thisCallableStatementwill default to typeResultSet.TYPE_FORWARD_ONLYand concurrencyResultSet.CONCUR_READ_ONLY. - Throws:
SQLException- if a problem occurs accessing the database.
-
prepareCall
Description copied from interface:ConnectionReturns a new instance ofCallableStatementthat may be used for making stored procedure calls to the database.ResultSets emitted from thisCallableStatementwill satisfy the specifiedresultSetTypeandresultSetConcurrencyvalues.- Specified by:
prepareCallin interfaceConnection- Parameters:
sql- the SQL statementx- one of the following type specifiers:y- one of the following concurrency mode specifiers:- Returns:
- a new instance of
CallableStatementrepresenting the precompiled SQL statement.ResultSets emitted from thisCallableStatementwill satisfy the specifiedresultSetTypeandresultSetConcurrencyvalues. - Throws:
SQLException- if a problem occurs accessing the database
-
prepareStatement
Description copied from interface:ConnectionReturns a new instance ofPreparedStatementthat may be used any number of times to execute parameterized requests on the database server.Subject to JDBC driver support, this operation will attempt to send the precompiled version of the statement to the database. If the driver does not support precompiled statements, the statement will not reach the database server until it is executed. This distinction determines the moment when
SQLExceptions get raised.By default,
ResultSets from the returned object will beResultSet.TYPE_FORWARD_ONLYtype with aResultSet.CONCUR_READ_ONLYmode of concurrency.- Specified by:
prepareStatementin interfaceConnection- Parameters:
sql- the SQL statement.- Returns:
- the
PreparedStatementcontaining the supplied SQL statement. - Throws:
SQLException- if there is a problem accessing the database.
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLExceptionDescription copied from interface:ConnectionCreates aPreparedStatementthat generatesResultSets with the specified values ofresultSetTypeandresultSetConcurrency.- Specified by:
prepareStatementin interfaceConnection- Parameters:
sql- the SQL statement. It can contain one or more'?'INparameter placeholders.resultSetType- one of the following type specifiers:resultSetConcurrency- one of the following concurrency mode specifiers:- Returns:
- a new instance of
PreparedStatementcontaining the SQL statementsql.ResultSets emitted from thisPreparedStatementwill satisfy the specifiedresultSetTypeandresultSetConcurrencyvalues. - Throws:
SQLException- if a problem occurs accessing the database.
-
rollback
Description copied from interface:ConnectionRolls back all updates made so far in this transaction and relinquishes all acquired database locks. It is an error to invoke this operation when in auto-commit mode.- Specified by:
rollbackin interfaceConnection- Throws:
SQLException- if there is a problem with the database or if the method is called while in auto-commit mode of operation.
-
setAutoCommit
Description copied from interface:ConnectionSets this connection's auto-commit modeonoroff.Putting a Connection into auto-commit mode means that all associated SQL statements are run and committed as separate transactions. By contrast, setting auto-commit to
offmeans that associated SQL statements get grouped into transactions that need to be completed by explicit calls to either theConnection.commit()orConnection.rollback()methods.Auto-commit is the default mode for new connection instances.
When in this mode, commits will automatically occur upon successful SQL statement completion or upon successful completion of an execute. Statements are not considered successfully completed until all associated
ResultSets and output parameters have been obtained or closed.Calling this operation during an uncommitted transaction will result in it being committed.
- Specified by:
setAutoCommitin interfaceConnection- Parameters:
ac-booleanindication of whether to put the target connection into auto-commit mode (true) or not (false).- Throws:
SQLException- if there is a problem accessing the database.
-
setCatalog
Description copied from interface:ConnectionSets the catalog name for this connection. This is used to select a subspace of the database for future work. If the driver does not support catalog names, this method is ignored.- Specified by:
setCatalogin interfaceConnection- Parameters:
catalog- the catalog name to use.- Throws:
SQLException- if there is a problem accessing the database.
-
setReadOnly
Description copied from interface:ConnectionSets this connection to read-only mode.This serves as a hint to the driver, which can enable database optimizations.
- Specified by:
setReadOnlyin interfaceConnection- Parameters:
ro-trueto set the Connection to read only mode.falsedisables read-only mode.- Throws:
SQLException- if there is a problem accessing the database.
-
setTransactionIsolation
Description copied from interface:ConnectionSets the transaction isolation level for this Connection.If this method is called during a transaction, the results are implementation defined.
- Specified by:
setTransactionIsolationin interfaceConnection- Parameters:
level- the new transaction isolation level to use from the following list of possible values:- Throws:
SQLException- if there is a problem with the database or if the value oflevelis not one of the expected constant values.
-
getTypeMap
Description copied from interface:ConnectionReturns the type mapping associated with thisConnectionobject. The type mapping must be set on the application level.- Specified by:
getTypeMapin interfaceConnection- Returns:
- the Type Map as a
java.util.Map. - Throws:
SQLException- if there is a problem accessing the database.
-
setTypeMap
Description copied from interface:ConnectionSets theTypeMapfor this connection. The inputmapshould contain mappings between complex Java and SQL types.- Specified by:
setTypeMapin interfaceConnection- Parameters:
map- the new type map.- Throws:
SQLException- if there is a problem accessing the database or ifmapis not an instance ofMap.
-
getHoldability
Description copied from interface:ConnectionReturns the holdability property that anyResultSetproduced by this instance will have.- Specified by:
getHoldabilityin interfaceConnection- Returns:
- one of the following holdability mode specifiers:
- Throws:
SQLException- if there is a problem accessing the a database.
-
setHoldability
Description copied from interface:ConnectionSets the holdability of theResultSets created by this Connection.- Specified by:
setHoldabilityin interfaceConnection- Parameters:
holdability- one of the following holdability mode specifiers:- Throws:
SQLException- if there is a problem accessing the database
-
setSavepoint
Description copied from interface:ConnectionCreates an unnamedSavepointin the current transaction.- Specified by:
setSavepointin interfaceConnection- Returns:
- a
Savepointobject for this savepoint. - Throws:
SQLException- if there is a problem accessing the database.
-
setSavepoint
Description copied from interface:ConnectionCreates a namedSavepointin the current transaction.- Specified by:
setSavepointin interfaceConnection- Parameters:
name- the name to use for the newSavepoint.- Returns:
- a
Savepointobject for this savepoint. - Throws:
SQLException- if there is a problem accessing the database.
-
rollback
Description copied from interface:ConnectionUndoes all changes made after the suppliedSavepointobject was set. This method should only be used when auto-commit mode is disabled.- Specified by:
rollbackin interfaceConnection- Parameters:
x- the Savepoint to roll back to- Throws:
SQLException- if there is a problem accessing the database.
-
releaseSavepoint
Description copied from interface:ConnectionReleases the specifiedsavepointfrom the present transaction. Once removed, theSavepointis considered invalid and should not be referenced further.- Specified by:
releaseSavepointin interfaceConnection- Parameters:
x- the object targeted for removal.- Throws:
SQLException- if there is a problem with accessing the database or ifsavepointis considered not valid in this transaction.
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLExceptionDescription copied from interface:ConnectionReturns a new instance ofStatementwhose associatedResultSets will have the characteristics specified in the type, concurrency and holdability arguments.- Specified by:
createStatementin interfaceConnection- Parameters:
resultSetType- one of the following type specifiers:resultSetConcurrency- one of the following concurrency mode specifiers:resultSetHoldability- one of the following holdability mode specifiers:- Returns:
- a new instance of
Statementcapable of manufacturingResultSets that satisfy the specifiedresultSetType,resultSetConcurrencyandresultSetHoldabilityvalues. - Throws:
SQLException- if there is a problem accessing the database.
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLExceptionDescription copied from interface:ConnectionCreates aPreparedStatementthat generatesResultSets with the specified type, concurrency and holdability- Specified by:
prepareStatementin interfaceConnection- Parameters:
sql- the SQL statement. It can contain one or more'?' INparameter placeholders.resultSetType- one of the following type specifiers:resultSetConcurrency- one of the following concurrency mode specifiers:resultSetHoldability- one of the following holdability mode specifiers:- Returns:
- a new instance of
PreparedStatementcontaining the SQL statementsql.ResultSets emitted from thisPreparedStatementwill satisfy the specifiedresultSetType,resultSetConcurrencyandresultSetHoldabilityvalues. - Throws:
SQLException- if a problem occurs accessing the database.
-
prepareCall
Description copied from interface:ConnectionReturns a new instance ofCallableStatementthat may be used for making stored procedure calls to the database.ResultSets created from thisCallableStatementwill have characteristics determined by the specified type, concurrency and holdability arguments.- Specified by:
prepareCallin interfaceConnection- Parameters:
sql- the SQL statementx- one of the following type specifiers:y- one of the following concurrency mode specifiers:z- one of the following holdability mode specifiers:- Returns:
- a new instance of
CallableStatementrepresenting the precompiled SQL statement.ResultSets emitted from thisCallableStatementwill satisfy the specifiedresultSetType,resultSetConcurrencyandresultSetHoldabilityvalues. - Throws:
SQLException- if a problem occurs accessing the database.
-
prepareStatement
Description copied from interface:ConnectionCreates a defaultPreparedStatementthat can retrieve automatically generated keys. ParameterautoGeneratedKeysmay be used to tell the driver whether such keys should be made accessible. This is only relevant when thesqlstatement is aninsertstatement.An SQL statement which may have
INparameters can be stored and precompiled in aPreparedStatement. ThePreparedStatementcan then be then be used to execute the statement multiple times in an efficient way.Subject to JDBC driver support, this operation will attempt to send the precompiled version of the statement to the database. If the driver does not support precompiled statements, the statement will not reach the database server until it is executed. This distinction determines the moment when
SQLExceptions get raised.By default,
ResultSets from the returned object will beResultSet.TYPE_FORWARD_ONLYtype with aResultSet.CONCUR_READ_ONLYmode of concurrency.- Specified by:
prepareStatementin interfaceConnection- Parameters:
sql- the SQL statement.autokeys- one of the following generated key options:- Returns:
- a new
PreparedStatementinstance representing the input SQL statement. - Throws:
SQLException- if there is a problem accessing the database.
-
prepareStatement
Description copied from interface:ConnectionCreates a defaultPreparedStatementthat can retrieve the auto-generated keys designated by a supplied array. Ifsqlis an SQLINSERTstatement, the parametercolumnIndexesis expected to hold the index values for each column in the statement's intended database table containing the autogenerated-keys of interest. OtherwisecolumnIndexesis ignored.Subject to JDBC driver support, this operation will attempt to send the precompiled version of the statement to the database. If the driver does not support precompiled statements, the statement will not reach the database server until it is executed. This distinction determines the moment when
SQLExceptions get raised.By default,
ResultSets from the returned object will beResultSet.TYPE_FORWARD_ONLYtype with aResultSet.CONCUR_READ_ONLYconcurrency mode.- Specified by:
prepareStatementin interfaceConnection- Parameters:
sql- the SQL statement.colIndexes- the indexes of the columns for which auto-generated keys should be made available.- Returns:
- the PreparedStatement containing the supplied SQL statement.
- Throws:
SQLException- if a problem occurs accessing the database.
-
prepareStatement
Description copied from interface:ConnectionCreates a defaultPreparedStatementthat can retrieve the auto-generated keys designated by a supplied array. Ifsqlis an SQLINSERTstatement,columnNamesis expected to hold the names of each column in the statement's associated database table containing the autogenerated-keys of interest. OtherwisecolumnNamesis ignored.Subject to JDBC driver support, this operation will attempt to send the precompiled version of the statement to the database. Alternatively, if the driver is not capable of handling precompiled statements, the statement will not reach the database server until it is executed. This will have a bearing on precisely when
SQLExceptioninstances get raised.By default, ResultSets from the returned object will be
ResultSet.TYPE_FORWARD_ONLYtype with aResultSet.CONCUR_READ_ONLYconcurrency mode.- Specified by:
prepareStatementin interfaceConnection- Parameters:
sql- the SQL statement.columns- the names of the columns for which auto-generated keys should be made available.- Returns:
- the PreparedStatement containing the supplied SQL statement.
- Throws:
SQLException- if a problem occurs accessing the database.
-
createClob
Description copied from interface:ConnectionReturns a new empty Clob.- Specified by:
createClobin interfaceConnection- Throws:
SQLException- if this connection is closed, or there's a problem creating a new clob.
-
createBlob
Description copied from interface:ConnectionReturns a new empty Blob.- Specified by:
createBlobin interfaceConnection- Throws:
SQLException- if this connection is closed, or there's a problem creating a new blob.
-
createNClob
Description copied from interface:ConnectionReturns a new empty NClob.- Specified by:
createNClobin interfaceConnection- Throws:
SQLException- if this connection is closed, or there's a problem creating a new nclob.
-
createSQLXML
Description copied from interface:ConnectionReturns a new empty SQLXML.- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException- if this connection is closed, or there's a problem creating a new XML.
-
isValid
Description copied from interface:ConnectionReturns true if this connection is still open and valid, false otherwise.- Specified by:
isValidin interfaceConnection- Parameters:
timeout- number of seconds to wait for a response before giving up and returning false, 0 to wait forever- Throws:
SQLException- iftimeout < 0
-
setClientInfo
Description copied from interface:ConnectionSets the client info propertynametovalue. A value of null clears the client info property.- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException- if this connection is closed, or there's a problem setting the property.
-
setClientInfo
Description copied from interface:ConnectionReplaces all client info properties with the name/value pairs fromproperties. All existing properties are removed. If an exception is thrown, the resulting state of this connection's client info properties is undefined.- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException- if this connection is closed, or there's a problem setting a property.
-
getClientInfo
Description copied from interface:ConnectionReturns the value corresponding to the given client info property, or null if unset.- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLClientInfoException- if this connection is closed, or there's a problem getting the property.SQLException
-
getClientInfo
Description copied from interface:ConnectionReturns aPropertiesobject containing all client info properties.- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLClientInfoException- if this connection is closed, or there's a problem getting a property.SQLException
-
createArrayOf
Description copied from interface:ConnectionReturns a newArraycontaining the givenelements.- Specified by:
createArrayOfin interfaceConnection- Parameters:
type- the SQL name of the type of the array elements- Throws:
SQLClientInfoException- if this connection is closed, or there's a problem creating the array.SQLException
-
createStruct
Description copied from interface:ConnectionReturns a newStructcontaining the givenattributes.- Specified by:
createStructin interfaceConnection- Parameters:
type- the SQL name of the type of the struct attributes- Throws:
SQLClientInfoException- if this connection is closed, or there's a problem creating the array.SQLException
-
unwrap
Description copied from interface:WrapperReturns an object that implements the given interface. If the caller is not a wrapper, a SQLException will be thrown.- Specified by:
unwrapin interfaceWrapper- Parameters:
iface- - the class that defines the interface- Returns:
- - an object that implements the interface
- Throws:
SQLException- - if there is no object implementing the specific interface
-
isWrapperFor
Description copied from interface:WrapperIf the caller is a wrapper of the class or implements the given interface, the methods return false and vice versa.- Specified by:
isWrapperForin interfaceWrapper- Parameters:
iface- - the class that defines the interface- Returns:
- - true if the instance implements the interface
- Throws:
SQLException- - when an error occurs when judges the object
-