Java Doc for EmbedConnection.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » jdbc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.jdbc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.jdbc.EmbedConnection

All known Subclasses:   org.apache.derby.impl.jdbc.EmbedConnection30,
EmbedConnection
public class EmbedConnection implements EngineConnection(Code)
Local implementation of Connection for a JDBC driver in the same process as the database.

There is always a single root (parent) connection. The initial JDBC connection is the root connection. A call to getCurrentConnection() or with the URL jdbc:default:connection yields a nested connection that shares the same root connection as the parent. A nested connection is implemented using this class. The nested connection copies the state of the parent connection and shares some of the same objects (e.g. ContextManager) that are shared across all nesting levels. The proxy also maintains its own state that is distinct from its parent connection (e.g. autocommit or warnings).

SYNCHRONIZATION: Just about all JDBC actions are synchronized across all connections stemming from the same root connection. The synchronization is upon the a synchronized object return by the rootConnection.

Supports

  • JDBC 2.0

author:
   djd
See Also:   TransactionResourceImpl


Field Summary
final public static  SQLExceptionNO_MEM
     Static exception to be thrown when a Connection request can not be fulfilled due to lack of memory.
 booleanautoCommit
    
 DatabaseMetaDatadbMetadata
    
final public static  LowMemorymemoryState
     Low memory state object for connection requests.
 booleanneedCommit
    
final  EmbedConnectionrootConnection
    
final  TransactionResourceImpltr
    

Constructor Summary
public  EmbedConnection(InternalDriver driver, String url, Properties info)
    
public  EmbedConnection(EmbedConnection inputConnection)
     Create a new connection based off of the connection passed in.

Method Summary
final public synchronized  voidaddWarning(SQLWarning newWarning)
     Add a warning to the current list of warnings, to follow this note from Connection.getWarnings. Note: Subsequent warnings will be chained to this SQLWarning.
final protected  voidcheckIfClosed()
     Raises an exception if the connection is closed.
final public synchronized  voidclearWarnings()
     After this call, getWarnings returns null until a new warning is reported for this Connection.
public  voidclose()
     In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released; the close method provides this immediate release.
public  voidcommit()
     Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection.
protected  voidcommitIfAutoCommit()
     If in autocommit, then commit. Used to force a commit after a result set closes in autocommit mode. The needCommit mechanism does not work correctly as there are times with cursors (like a commit, followed by a next, followed by a close) where the system does not think it needs a commit but we need to force the commit on close.
protected  voidcommitIfNeeded()
     if a commit is needed, perform it.
final public  StatementcreateStatement()
     SQL statements without parameters are normally executed using Statement objects.
final public  StatementcreateStatement(int resultSetType, int resultSetConcurrency)
     JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden.
final public  StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
     JDBC 3.0 Same as createStatement() above, but allows the default result set type, result set concurrency type and result set holdability type to be overridden.
protected  voidfinalize()
    
final public  java.sql.ConnectiongetApplicationConnection()
    
public  booleangetAutoCommit()
     Get the current auto-commit state.
public  StringgetCatalog()
     Return the Connection's current catalog name.
final protected  ObjectgetConnectionSynchronization()
    
final public  ContextManagergetContextManager()
     Return the context manager for this connection.
public  StringgetDBName()
     Return the dbname for this connection.
protected  DatabasegetDatabase()
    
public  intgetEngineType()
     Gets the EngineType of the connected database. 0 if there is no database, the engine type otherwise.
final public  intgetHoldability()
     JDBC 3.0 Retrieves the current holdability of ResultSet objects created using this Connection object.
final public  LanguageConnectionContextgetLanguageConnection()
    
final public  InternalDrivergetLocalDriver()
    
public  DatabaseMetaDatagetMetaData()
     A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc.
public  intgetPrepareIsolation()
    
final  intgetResultSetOrderId()
     Return a unique order number for a result set.
final protected  TransactionResourceImplgetTR()
    
final public  intgetTransactionIsolation()
     Get this Connection's current transaction isolation mode.
public  java.util.MapgetTypeMap()
     Get the type-map object associated with this connection.
final public synchronized  SQLWarninggetWarnings()
     The first warning reported by calls on this Connection is returned.
 SQLExceptionhandleException(Throwable thrownException)
    
final  SQLExceptionhandleException(Throwable thrownException, boolean rollbackOnAutoCommit)
     Handle any type of Exception.
  • Inform the contexts of the error
  • Throw an Util based upon the thrown exception.
REMIND: now that we know all the exceptions from our driver are Utils, would it make sense to shut down the system for unknown SQLExceptions? At present, we do not. Because this is the last stop for exceptions, it will catch anything that occurs in it and try to cleanup before re-throwing them.
Parameters:
  thrownException - the exception
Parameters:
  rollbackOnAutoCommit - rollback the xact on if autocommit ison, otherwise rollback stmt but leave xact open (andcontinue to hold on to locks).
final public  booleanisClosed()
     Tests to see if a Connection is closed.
final public  booleanisReadOnly()
     Tests to see if the connection is in read-only mode.
public  StringnativeSQL(String sql)
     A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent.
protected  voidneedCommit()
     if auto commit is on, remember that we need to commit the current statement.
protected  SQLExceptionnewSQLException(String messageId)
    
protected  SQLExceptionnewSQLException(String messageId, Object arg1)
    
protected  SQLExceptionnewSQLException(String messageId, Object arg1, Object arg2)
    
final public  CallableStatementprepareCall(String sql)
     A SQL stored procedure call statement is handled by creating a CallableStatement for it.
final public  CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency)
     JDBC 2.0 Same as prepareCall() above, but allows the default result set type and result set concurrency type to be overridden.
final public  CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
     JDBC 3.0 Same as prepareCall() above, but allows the default result set type, result set concurrency type and result set holdability to be overridden.
 PreparedStatementprepareMetaDataStatement(String sql)
    
final public  PreparedStatementprepareStatement(String sql)
     A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object.
final public  PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency)
     JDBC 2.0 Same as prepareStatement() above, but allows the default result set type and result set concurrency type to be overridden.
final public  PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
     JDBC 3.0 Same as prepareStatement() above, but allows the default result set type, result set concurrency type and result set holdability to be overridden.
final public  PreparedStatementprepareStatement(String sql, int[] columnIndexes)
     Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
final public  PreparedStatementprepareStatement(String sql, String[] columnNames)
     Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
final public  PreparedStatementprepareStatement(String sql, int autoGeneratedKeys)
     Creates a default PreparedStatement object that has the capability to retieve auto-generated keys.
public  voidresetFromPool()
     Reset the connection before it is returned from a PooledConnection to a new application request (wrapped by a BrokeredConnection).
final protected  voidrestoreContextStack()
    
public  voidrollback()
     Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection.
final public  voidsetApplicationConnection(java.sql.Connection applicationConnection)
    
public  voidsetAutoCommit(boolean autoCommit)
     If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions.
public  voidsetCatalog(String catalog)
     A sub-space of this Connection's database may be selected by setting a catalog name.
public  voidsetDrdaID(String drdaID)
    
final public  voidsetHoldability(int holdability)
     JDBC 3.0 Changes the holdability of ResultSet objects created using this Connection object to the given holdability.
final public  voidsetInactive()
     Close the connection when processing errors, or when closing a nested connection.
public  voidsetPrepareIsolation(int level)
     Set the transaction isolation level that will be used for the next prepare.
final public  voidsetReadOnly(boolean readOnly)
     You can put a connection in read-only mode as a hint to enable database optimizations.

Note: setReadOnly cannot be called while in the middle of a transaction.
Parameters:
  readOnly - true enables read-only mode; false disablesread-only mode.

public  voidsetTransactionIsolation(int level)
     You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values.
final public  voidsetTypeMap(java.util.Map map)
     Install a type-map object as the default type-map for this connection.
final protected  voidsetupContextStack()
     Install the context manager for this thread.
public  StringtoString()
     Get a String representation that uniquely identifies this connection.
final public  booleantransactionIsIdle()
     returns false if there is an underlying transaction and that transaction has done work.
final public  voidxa_commit(boolean onePhase)
    
final public  intxa_prepare()
    
final public  voidxa_rollback()
    

Field Detail
NO_MEM
final public static SQLException NO_MEM(Code)
Static exception to be thrown when a Connection request can not be fulfilled due to lack of memory. A static exception as the lack of memory would most likely cause another OutOfMemoryException and if there is not enough memory to create the OOME exception then something like the VM dying could occur. Simpler just to throw a static.



autoCommit
boolean autoCommit(Code)



dbMetadata
DatabaseMetaData dbMetadata(Code)



memoryState
final public static LowMemory memoryState(Code)
Low memory state object for connection requests.



needCommit
boolean needCommit(Code)



rootConnection
final EmbedConnection rootConnection(Code)



tr
final TransactionResourceImpl tr(Code)




Constructor Detail
EmbedConnection
public EmbedConnection(InternalDriver driver, String url, Properties info) throws SQLException(Code)



EmbedConnection
public EmbedConnection(EmbedConnection inputConnection)(Code)
Create a new connection based off of the connection passed in. Initializes state based on input connection, and copies appropriate object pointers. This is only used for nested connections.
Parameters:
  inputConnection - the input connection




Method Detail
addWarning
final public synchronized void addWarning(SQLWarning newWarning)(Code)
Add a warning to the current list of warnings, to follow this note from Connection.getWarnings. Note: Subsequent warnings will be chained to this SQLWarning.
See Also:   java.sql.Connection.getWarnings



checkIfClosed
final protected void checkIfClosed() throws SQLException(Code)
Raises an exception if the connection is closed.
exception:
  SQLException - if the connection is closed



clearWarnings
final public synchronized void clearWarnings() throws SQLException(Code)
After this call, getWarnings returns null until a new warning is reported for this Connection. Synchronization node: Warnings are synchonized on nesting level



close
public void close() throws SQLException(Code)
In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released; the close method provides this immediate release.

Note: A Connection is automatically closed when it is garbage collected. Certain fatal errors also result in a closed Connection.
exception:
  SQLException - if a database-access error occurs.




commit
public void commit() throws SQLException(Code)
Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection. This method should only be used when auto commit has been disabled.
exception:
  SQLException - if a database-access error occurs.
See Also:   EmbedConnection.setAutoCommit
See Also:   



commitIfAutoCommit
protected void commitIfAutoCommit() throws SQLException(Code)
If in autocommit, then commit. Used to force a commit after a result set closes in autocommit mode. The needCommit mechanism does not work correctly as there are times with cursors (like a commit, followed by a next, followed by a close) where the system does not think it needs a commit but we need to force the commit on close. It seemed safer to just force a commit on close rather than count on keeping the needCommit flag correct for all cursor cases. Must have connection synchonization and context set up already.
exception:
  SQLException - if commit returns error



commitIfNeeded
protected void commitIfNeeded() throws SQLException(Code)
if a commit is needed, perform it. Must have connection synchonization and context set up already.
exception:
  SQLException - if commit returns error



createStatement
final public Statement createStatement() throws SQLException(Code)
SQL statements without parameters are normally executed using Statement objects. If the same SQL statement is executed many times, it is more efficient to use a PreparedStatement JDBC 2.0 Result sets created using the returned Statement will have forward-only type, and read-only concurrency, by default. a new Statement object
exception:
  SQLException - if a database-access error occurs.



createStatement
final public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException(Code)
JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden.
Parameters:
  resultSetType - a result set type, see ResultSet.TYPE_XXX
Parameters:
  resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX a new Statement object
exception:
  SQLException - if a database-access error occurs.



createStatement
final public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code)
JDBC 3.0 Same as createStatement() above, but allows the default result set type, result set concurrency type and result set holdability type to be overridden.
Parameters:
  resultSetType - a result set type, see ResultSet.TYPE_XXX
Parameters:
  resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX
Parameters:
  resultSetHoldability - a holdability type,ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT a new Statement object
exception:
  SQLException - if a database-access error occurs.



finalize
protected void finalize() throws Throwable(Code)

exception:
  Throwable - standard error policy



getApplicationConnection
final public java.sql.Connection getApplicationConnection()(Code)



getAutoCommit
public boolean getAutoCommit() throws SQLException(Code)
Get the current auto-commit state. Current state of auto-commit mode.
See Also:   EmbedConnection.setAutoCommit
See Also:   



getCatalog
public String getCatalog() throws SQLException(Code)
Return the Connection's current catalog name. the current catalog name or null
exception:
  SQLException - if a database-access error occurs.



getConnectionSynchronization
final protected Object getConnectionSynchronization()(Code)



getContextManager
final public ContextManager getContextManager()(Code)
Return the context manager for this connection.



getDBName
public String getDBName()(Code)
Return the dbname for this connection. String The dbname for this connection.



getDatabase
protected Database getDatabase()(Code)



getEngineType
public int getEngineType()(Code)
Gets the EngineType of the connected database. 0 if there is no database, the engine type otherwise. @see org.apache.derby.iapi.reference.EngineType



getHoldability
final public int getHoldability() throws SQLException(Code)
JDBC 3.0 Retrieves the current holdability of ResultSet objects created using this Connection object. The holdability, one of ResultSet.HOLD_CURSORS_OVER_COMMITor ResultSet.CLOSE_CURSORS_AT_COMMIT



getLanguageConnection
final public LanguageConnectionContext getLanguageConnection()(Code)



getLocalDriver
final public InternalDriver getLocalDriver()(Code)



getMetaData
public DatabaseMetaData getMetaData() throws SQLException(Code)
A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. This information is made available through a DatabaseMetaData object. a DatabaseMetaData object for this Connection
exception:
  SQLException - if a database-access error occurs.



getPrepareIsolation
public int getPrepareIsolation()(Code)
Return prepare isolation



getResultSetOrderId
final int getResultSetOrderId()(Code)
Return a unique order number for a result set. A unique value is only needed if the result set is being created within procedure and thus must be using a nested connection.



getTR
final protected TransactionResourceImpl getTR()(Code)



getTransactionIsolation
final public int getTransactionIsolation() throws SQLException(Code)
Get this Connection's current transaction isolation mode. the current TRANSACTION_* mode value
exception:
  SQLException - if a database-access error occurs.



getTypeMap
public java.util.Map getTypeMap() throws SQLException(Code)
Get the type-map object associated with this connection. By default, the map returned is empty. JDBC 2.0 - java.util.Map requires JDK 1



getWarnings
final public synchronized SQLWarning getWarnings() throws SQLException(Code)
The first warning reported by calls on this Connection is returned.

Note: Subsequent warnings will be chained to this SQLWarning. the first SQLWarning or null Synchronization note: Warnings are synchronized on nesting level




handleException
SQLException handleException(Throwable thrownException) throws SQLException(Code)



handleException
final SQLException handleException(Throwable thrownException, boolean rollbackOnAutoCommit) throws SQLException(Code)
Handle any type of Exception.
  • Inform the contexts of the error
  • Throw an Util based upon the thrown exception.
REMIND: now that we know all the exceptions from our driver are Utils, would it make sense to shut down the system for unknown SQLExceptions? At present, we do not. Because this is the last stop for exceptions, it will catch anything that occurs in it and try to cleanup before re-throwing them.
Parameters:
  thrownException - the exception
Parameters:
  rollbackOnAutoCommit - rollback the xact on if autocommit ison, otherwise rollback stmt but leave xact open (andcontinue to hold on to locks). Most of the time, thiswill be true, excepting operations on result sets, likegetInt().



isClosed
final public boolean isClosed()(Code)
Tests to see if a Connection is closed. true if the connection is closed; false if it's still open



isReadOnly
final public boolean isReadOnly() throws SQLException(Code)
Tests to see if the connection is in read-only mode. true if connection is read-only
exception:
  SQLException - if a database-access error occurs.



nativeSQL
public String nativeSQL(String sql) throws SQLException(Code)
A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent.
Parameters:
  sql - a SQL statement that may contain one or more '?'parameter placeholders the native form of this statement



needCommit
protected void needCommit()(Code)
if auto commit is on, remember that we need to commit the current statement.



newSQLException
protected SQLException newSQLException(String messageId)(Code)



newSQLException
protected SQLException newSQLException(String messageId, Object arg1)(Code)



newSQLException
protected SQLException newSQLException(String messageId, Object arg1, Object arg2)(Code)



prepareCall
final public CallableStatement prepareCall(String sql) throws SQLException(Code)
A SQL stored procedure call statement is handled by creating a CallableStatement for it. The CallableStatement provides methods for setting up its IN and OUT parameters, and methods for executing it.

Note: This method is optimized for handling stored procedure call statements. Some drivers may send the call statement to the database when the prepareCall is done; others may wait until the CallableStatement is executed. This has no direct affect on users; however, it does affect which method throws certain SQLExceptions. JDBC 2.0 Result sets created using the returned CallableStatement will have forward-only type, and read-only concurrency, by default.
Parameters:
  sql - a SQL statement that may contain one or more '?'parameter placeholders. Typically this statement is a JDBCfunction call escape string. a new CallableStatement object containing thepre-compiled SQL statement
exception:
  SQLException - if a database-access error occurs.




prepareCall
final public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException(Code)
JDBC 2.0 Same as prepareCall() above, but allows the default result set type and result set concurrency type to be overridden.
Parameters:
  resultSetType - a result set type, see ResultSet.TYPE_XXX
Parameters:
  resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX a new CallableStatement object containing thepre-compiled SQL statement
exception:
  SQLException - if a database-access error occurs.



prepareCall
final public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code)
JDBC 3.0 Same as prepareCall() above, but allows the default result set type, result set concurrency type and result set holdability to be overridden.
Parameters:
  resultSetType - a result set type, see ResultSet.TYPE_XXX
Parameters:
  resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX
Parameters:
  resultSetHoldability - - one of the following ResultSet constants:ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT a new CallableStatement object containing thepre-compiled SQL statement
exception:
  SQLException - if a database-access error occurs.



prepareMetaDataStatement
PreparedStatement prepareMetaDataStatement(String sql) throws SQLException(Code)



prepareStatement
final public PreparedStatement prepareStatement(String sql) throws SQLException(Code)
A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, prepareStatement will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement is executed. This has no direct affect on users; however, it does affect which method throws certain SQLExceptions. JDBC 2.0 Result sets created using the returned PreparedStatement will have forward-only type, and read-only concurrency, by default.
Parameters:
  sql - a SQL statement that may contain one or more '?' INparameter placeholders a new PreparedStatement object containing thepre-compiled statement
exception:
  SQLException - if a database-access error occurs.




prepareStatement
final public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException(Code)
JDBC 2.0 Same as prepareStatement() above, but allows the default result set type and result set concurrency type to be overridden.
Parameters:
  resultSetType - a result set type, see ResultSet.TYPE_XXX
Parameters:
  resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX a new PreparedStatement object containing thepre-compiled SQL statement
exception:
  SQLException - if a database-access error occurs.



prepareStatement
final public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code)
JDBC 3.0 Same as prepareStatement() above, but allows the default result set type, result set concurrency type and result set holdability to be overridden.
Parameters:
  resultSetType - a result set type, see ResultSet.TYPE_XXX
Parameters:
  resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX
Parameters:
  resultSetHoldability - - one of the following ResultSet constants:ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT a new PreparedStatement object containing thepre-compiled SQL statement
exception:
  SQLException - if a database-access error occurs.



prepareStatement
final public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException(Code)
Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. This array is ignored if the SQL statement is not an INSERT statement JDBC 3.0
Parameters:
  sql - An SQL statement that may contain one or more ? IN parameter placeholders
Parameters:
  columnIndexes - An array of column indexes indicating the columnsthat should be returned from the inserted row or rows A new PreparedStatement object, containing the pre-compiledSQL statement, that will have the capability of returning auto-generated keysdesignated by the given array of column indexes
exception:
  SQLException - Feature not implemented for now.



prepareStatement
final public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException(Code)
Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the names of the columns in the target table that contain the auto-generated keys that should be returned. This array is ignored if the SQL statement is not an INSERT statement JDBC 3.0
Parameters:
  sql - An SQL statement that may contain one or more ? IN parameter placeholders
Parameters:
  columnNames - An array of column names indicating the columnsthat should be returned from the inserted row or rows A new PreparedStatement object, containing the pre-compiledSQL statement, that will have the capability of returning auto-generated keysdesignated by the given array of column names
exception:
  SQLException - Feature not implemented for now.



prepareStatement
final public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException(Code)
Creates a default PreparedStatement object that has the capability to retieve auto-generated keys. The given constant tells the driver whether it should make auto-generated keys available for retrieval. This parameter is ignored if the SQL statement is not an INSERT statement. JDBC 3.0
Parameters:
  sql - A SQL statement that may contain one or more ? IN parameter placeholders
Parameters:
  autoGeneratedKeys - A flag indicating whether auto-generated keysshould be returned A new PreparedStatement object, containing the pre-compiledSQL statement, that will have the capability of returning auto-generated keys
exception:
  SQLException - Feature not implemented for now.



resetFromPool
public void resetFromPool() throws SQLException(Code)
Reset the connection before it is returned from a PooledConnection to a new application request (wrapped by a BrokeredConnection). Examples of reset covered here is dropping session temporary tables and reseting IDENTITY_VAL_LOCAL. Most JDBC level reset is handled by calling standard java.sql.Connection methods from EmbedPooledConnection.



restoreContextStack
final protected void restoreContextStack() throws SQLException(Code)



rollback
public void rollback() throws SQLException(Code)
Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection. This method should only be used when auto commit has been disabled.
exception:
  SQLException - if a database-access error occurs.
See Also:   EmbedConnection.setAutoCommit
See Also:   



setApplicationConnection
final public void setApplicationConnection(java.sql.Connection applicationConnection)(Code)



setAutoCommit
public void setAutoCommit(boolean autoCommit) throws SQLException(Code)
If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by either commit() or rollback(). By default, new connections are in auto-commit mode. The commit occurs when the statement completes or the next execute occurs, whichever comes first. In the case of statements returning a ResultSet, the statement completes when the last row of the ResultSet has been retrieved or the ResultSet has been closed. In advanced cases, a single statement may return multiple results as well as output parameter values. Here the commit occurs when all results and output param values have been retrieved.
Parameters:
  autoCommit - true enables auto-commit; false disablesauto-commit.
exception:
  SQLException - if a database-access error occurs.



setCatalog
public void setCatalog(String catalog) throws SQLException(Code)
A sub-space of this Connection's database may be selected by setting a catalog name. If the driver does not support catalogs it will silently ignore this request.
exception:
  SQLException - if a database-access error occurs.



setDrdaID
public void setDrdaID(String drdaID)(Code)



setHoldability
final public void setHoldability(int holdability) throws SQLException(Code)
JDBC 3.0 Changes the holdability of ResultSet objects created using this Connection object to the given holdability.
Parameters:
  holdability - A ResultSet holdability constant, one of ResultSet.HOLD_CURSORS_OVER_COMMITor ResultSet.CLOSE_CURSORS_AT_COMMIT



setInactive
final public void setInactive()(Code)
Close the connection when processing errors, or when closing a nested connection.

This only marks it as closed and frees up its resources; any closing of the underlying connection or commit work is assumed to be done elsewhere. Called from EmbedConnectionContext's cleanup routine, and by proxy.close().




setPrepareIsolation
public void setPrepareIsolation(int level) throws SQLException(Code)
Set the transaction isolation level that will be used for the next prepare. Used by network server to implement DB2 style isolation levels.
Parameters:
  level - Isolation level to change to. level is the DB2 levelspecified in the package names which happen to correspondto our internal levels. If level == ExecutionContext.UNSPECIFIED_ISOLATION,the statement won't be prepared with an isolation level.



setReadOnly
final public void setReadOnly(boolean readOnly) throws SQLException(Code)
You can put a connection in read-only mode as a hint to enable database optimizations.

Note: setReadOnly cannot be called while in the middle of a transaction.
Parameters:
  readOnly - true enables read-only mode; false disablesread-only mode.
exception:
  SQLException - if a database-access error occurs.




setTransactionIsolation
public void setTransactionIsolation(int level) throws SQLException(Code)
You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values.

Note: setTransactionIsolation causes the current transaction to commit
Parameters:
  level - one of the TRANSACTION_* isolation values with theexception of TRANSACTION_NONE; some databases may not supportother values
exception:
  SQLException - if a database-access error occurs.
See Also:   DatabaseMetaData.supportsTransactionIsolationLevel
See Also:   




setTypeMap
final public void setTypeMap(java.util.Map map) throws SQLException(Code)
Install a type-map object as the default type-map for this connection. JDBC 2.0 - java.util.Map requires JDK 1
exception:
  SQLException - Feature not implemented for now.



setupContextStack
final protected void setupContextStack() throws SQLException(Code)
Install the context manager for this thread. Check connection status here.
exception:
  SQLException - if fails



toString
public String toString()(Code)
Get a String representation that uniquely identifies this connection. Include the same information that is printed in the log for various trace and error messages. In Derby the "physical" connection is a LanguageConnectionContext, or LCC. The JDBC Connection is an JDBC-specific layer on top of this. Rather than create a new id here, we simply use the id of the underlying LCC. Note that this is a big aid in debugging, because much of the engine trace and log code prints the LCC id. a string representation for this connection



transactionIsIdle
final public boolean transactionIsIdle()(Code)
returns false if there is an underlying transaction and that transaction has done work. True if there is no underlying transaction or that underlying transaction is idle



xa_commit
final public void xa_commit(boolean onePhase) throws SQLException(Code)



xa_prepare
final public int xa_prepare() throws SQLException(Code)



xa_rollback
final public void xa_rollback() throws SQLException(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.