Java Doc for Connection.java in  » Apache-Harmony-Java-SE » java-package » java » sql » 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 » Apache Harmony Java SE » java package » java.sql 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.sql.Connection

Connection
public interface Connection (Code)
A Connection represents a link from a Java application to a database. All SQL statements and results are returned within the context of a connection.


Field Summary
final public static  intTRANSACTION_NONE
     A constant indicating that transactions are not supported.
final public static  intTRANSACTION_READ_COMMITTED
     No dirty reads are permitted.
final public static  intTRANSACTION_READ_UNCOMMITTED
     Dirty reads (reading from table rows containing changes that have not yet been committed), non-repeatable reads (reading table rows more than once in a transaction but getting back different data because other transactions may have altered rows between reads), and phantom reads (retrieving additional "phantom" rows in the course of repeated table reads because other transactions may have inserted additional rows that satisfy an SQL WHERE clause) are all permitted.
final public static  intTRANSACTION_REPEATABLE_READ
     A constant indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur.
final public static  intTRANSACTION_SERIALIZABLE
     Dirty reads (reading from table rows containing changes that have not yet been committed), non-repeatable reads (reading table rows more than once in a transaction but getting back different data because other transactions may have altered rows between reads), and phantom reads (retrieving additional "phantom" rows in the course of repeated table reads because other transactions may have inserted additional rows that satisfy an SQL WHERE clause) are all prevented.


Method Summary
public  voidclearWarnings()
     Throws away any warnings that may have arisen for this connection.
public  voidclose()
     Causes the instant release of all database and driver connection resources associated with this object.
public  voidcommit()
     Commits all of the changes made subsequent to the last commit or rollback of the associated transaction.
public  StatementcreateStatement()
     Returns a new instance of Statement for issuing SQL commands to the remote database.
public  StatementcreateStatement(int resultSetType, int resultSetConcurrency)
     Returns a new instance of Statement whose associated ResultSets will have the characteristics specified in the type, concurrency and holdability arguments.
public  StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
     Returns a new instance of Statement whose associated ResultSets will have the characteristics specified in the type, concurrency and holdability arguments.
public  booleangetAutoCommit()
     Returns a boolean indication of whether or not this connection is in the auto-commit operating mode.
public  StringgetCatalog()
     Gets this Connection object's current catalog name. the catalog name.
public  intgetHoldability()
     Returns the kind of holdability that any ResultSets made from this instance will have.
public  DatabaseMetaDatagetMetaData()
     Gets the metadata about the database referenced by this connection.
public  intgetTransactionIsolation()
     Returns the present value of transaction isolation for this Connection instance.
public  Map<String, Class<?>>getTypeMap()
     Returns the Type Map associated with this Connection object.
public  SQLWarninggetWarnings()
     Gets the first instance of any SQLWarning objects that may have been created in the use of this connection.
public  booleanisClosed()
     Returns a boolean indication of whether or not this connection is in the closed state.
public  booleanisReadOnly()
     Returns a boolean indication of whether or not this connection is currently in read-only state.
public  StringnativeSQL(String sql)
     Returns a string representation of the input SQL statement sql expressed in the underlying system's native SQL syntax.
Parameters:
  sql - the JDBC form of an SQL statement.
public  CallableStatementprepareCall(String sql)
     Returns a new instance of CallableStatement that may be used for making stored procedure calls to the database.
Parameters:
  sql - the SQL statement that calls the stored function a new instance of CallableStatement representingthe SQL statement.
public  CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency)
     Returns a new instance of CallableStatement that may be used for making stored procedure calls to the database. ResultSets emitted from this CallableStatement will satisfy the specified resultSetType and resultSetConcurrency values.
Parameters:
  sql - the SQL statement
Parameters:
  resultSetType - one of :
Parameters:
  resultSetConcurrency - one of : a new instance of CallableStatement representingthe precompiled SQL statement.
public  CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
     Returns a new instance of CallableStatement that may be used for making stored procedure calls to the database.
public  PreparedStatementprepareStatement(String sql)
     Returns a new instance of PreparedStatement that 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.

public  PreparedStatementprepareStatement(String sql, int autoGeneratedKeys)
     Creates a default PreparedStatement that can retrieve automatically generated keys.
public  PreparedStatementprepareStatement(String sql, int[] columnIndexes)
     Creates a default PreparedStatement that can retrieve the auto-generated keys designated by a supplied array.
public  PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency)
     Creates a PreparedStatement that generates ResultSets with the specified values of resultSetType and resultSetConcurrency.
Parameters:
  sql - the SQL statement.
public  PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
     Creates a PreparedStatement that generates ResultSets with the specified type, concurrency and holdability
Parameters:
  sql - the SQL statement.
public  PreparedStatementprepareStatement(String sql, String[] columnNames)
     Creates a default PreparedStatement that can retrieve the auto-generated keys designated by a supplied array.
public  voidreleaseSavepoint(Savepoint savepoint)
     Releases savepoint from the present transaction.
public  voidrollback()
     Rolls back all updates made so far in this transaction as well as relinquishing all acquired database locks.
public  voidrollback(Savepoint savepoint)
     Undoes all changes made after the supplied Savepoint object was set.
public  voidsetAutoCommit(boolean autoCommit)
     Sets this connection's auto-commit mode on or off.
public  voidsetCatalog(String catalog)
     Sets the catalog name for this connection.
public  voidsetHoldability(int holdability)
     Sets the holdability of ResultSets created by this Connection.
public  voidsetReadOnly(boolean readOnly)
     Sets this connection to read-only mode.

This serves as a hint to the driver, which can enable database optimizations.
Parameters:
  readOnly - true to set the Connection to read only mode.

public  SavepointsetSavepoint()
     Creates an unnamed Savepoint in the current transaction.
public  SavepointsetSavepoint(String name)
     Creates a named Savepoint in the current transaction.
Parameters:
  name - the name to use for the new Savepoint.
public  voidsetTransactionIsolation(int level)
     Sets the transaction isolation level for this Connection.
public  voidsetTypeMap(Map<String, Class<?>> map)
     Sets the TypeMap for this connection.

Field Detail
TRANSACTION_NONE
final public static int TRANSACTION_NONE(Code)
A constant indicating that transactions are not supported.



TRANSACTION_READ_COMMITTED
final public static int TRANSACTION_READ_COMMITTED(Code)
No dirty reads are permitted. Transactions may not read a row containing changes that have not yet been committed.



TRANSACTION_READ_UNCOMMITTED
final public static int TRANSACTION_READ_UNCOMMITTED(Code)
Dirty reads (reading from table rows containing changes that have not yet been committed), non-repeatable reads (reading table rows more than once in a transaction but getting back different data because other transactions may have altered rows between reads), and phantom reads (retrieving additional "phantom" rows in the course of repeated table reads because other transactions may have inserted additional rows that satisfy an SQL WHERE clause) are all permitted.



TRANSACTION_REPEATABLE_READ
final public static int TRANSACTION_REPEATABLE_READ(Code)
A constant indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur.



TRANSACTION_SERIALIZABLE
final public static int TRANSACTION_SERIALIZABLE(Code)
Dirty reads (reading from table rows containing changes that have not yet been committed), non-repeatable reads (reading table rows more than once in a transaction but getting back different data because other transactions may have altered rows between reads), and phantom reads (retrieving additional "phantom" rows in the course of repeated table reads because other transactions may have inserted additional rows that satisfy an SQL WHERE clause) are all prevented.





Method Detail
clearWarnings
public void clearWarnings() throws SQLException(Code)
Throws away any warnings that may have arisen for this connection. Subsequent calls to Connection.getWarnings() will return null up until a brand new warning condition occurs.
throws:
  SQLException - if there is a problem accessing the database



close
public void close() throws SQLException(Code)
Causes the instant release of all database and driver connection resources associated with this object. Any subsequent invocations of this method will have no effect.

It is strongly recommended that all Connections are closed before they are dereferenced by the application ready for garbage collection. While the finalize method of the Connection will close the Connection before garbage collection takes place, it is not advisable to leave the close operation to take place in this way. Unpredictable performance may result from closing Connections in the finalizer.
throws:
  SQLException - if there is a problem accessing the database




commit
public void commit() throws SQLException(Code)
Commits all of the changes made subsequent to the last commit or rollback of the associated transaction. All locks in the database held by this connection are also relinquished. Calling this operation on connection objects in auto-commit mode is an error.
throws:
  SQLException - if there is a problem accessing the database or if the targetconnection instance is in auto-commit mode.



createStatement
public Statement createStatement() throws SQLException(Code)
Returns a new instance of Statement for issuing SQL commands to the remote database.

ResultSets generated by the returned Statement will default to type TYPE_FORWARD_ONLY and concurrency level CONCUR_READ_ONLY. a Statement object with default settings.
throws:
  SQLException - if there is a problem accessing the database




createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException(Code)
Returns a new instance of Statement whose associated ResultSets will have the characteristics specified in the type, concurrency and holdability arguments.
Parameters:
  resultSetType - one of :
Parameters:
  resultSetConcurrency - one of : a new instance of Statement capable ofmanufacturing ResultSets that satisfy thespecified resultSetType andresultSetConcurrency values.
throws:
  SQLException - if there is a problem accessing the database



createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code)
Returns a new instance of Statement whose associated ResultSets will have the characteristics specified in the type, concurrency and holdability arguments.
Parameters:
  resultSetType - one of :
Parameters:
  resultSetConcurrency - one of :
Parameters:
  resultSetHoldability - one of : a new instance of Statement capable ofmanufacturing ResultSets that satisfy thespecified resultSetType,resultSetConcurrency andresultSetHoldability values.
throws:
  SQLException - if there is a problem accessing the database



getAutoCommit
public boolean getAutoCommit() throws SQLException(Code)
Returns a boolean indication of whether or not this connection is in the auto-commit operating mode. true if auto-commit is on, otherwisefalse
throws:
  SQLException - if there is a problem accessing the database



getCatalog
public String getCatalog() throws SQLException(Code)
Gets this Connection object's current catalog name. the catalog name. null if there is no catalogname.
throws:
  SQLException - if there is a problem accessing the database



getHoldability
public int getHoldability() throws SQLException(Code)
Returns the kind of holdability that any ResultSets made from this instance will have. one of :
throws:
  SQLException - if there is a problem accessing the a database



getMetaData
public DatabaseMetaData getMetaData() throws SQLException(Code)
Gets the metadata about the database referenced by this connection. The returned DatabaseMetaData describes the database topography, available stored procedures, SQL syntax and so on. a DatabaseMetaData object containing the databasedescription
throws:
  SQLException - if there is a problem accessing the a database



getTransactionIsolation
public int getTransactionIsolation() throws SQLException(Code)
Returns the present value of transaction isolation for this Connection instance. the transaction isolation value
throws:
  SQLException - if there is a problem accessing the database
See Also:   Connection.TRANSACTION_NONE
See Also:   Connection.TRANSACTION_READ_COMMITTED
See Also:   Connection.TRANSACTION_READ_UNCOMMITTED
See Also:   Connection.TRANSACTION_REPEATABLE_READ
See Also:   Connection.TRANSACTION_SERIALIZABLE



getTypeMap
public Map<String, Class<?>> getTypeMap() throws SQLException(Code)
Returns the Type Map associated with this Connection object. The type map will be empty unless the application has added at least one entry. the Type Map as a java.util.Map
throws:
  SQLException - if there is a problem accessing the database



getWarnings
public SQLWarning getWarnings() throws SQLException(Code)
Gets the first instance of any SQLWarning objects 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. A null indicates that no warnings have occurred.

By invoking the SQLWarning.getNextWarning method of the returned SQLWarning object it is possible to obtain all warning objects. the first warning as an SQLWarning object (may benull)
throws:
  SQLException - if there is a problem accessing the database or if the callhas been made on a connection which has been previouslyclosed.




isClosed
public boolean isClosed() throws SQLException(Code)
Returns a boolean indication of whether or not this connection is in the closed state. The closed state may be entered into as a consequence of a successful invocation of the Connection.close() method or else if an error has occurred that prevents the connection from functioning normally. true if closed, otherwise false
throws:
  SQLException - if there is a problem accessing the database



isReadOnly
public boolean isReadOnly() throws SQLException(Code)
Returns a boolean indication of whether or not this connection is currently in read-only state. true if in read-only state, otherwisefalse.
throws:
  SQLException - if there is a problem accessing the database



nativeSQL
public String nativeSQL(String sql) throws SQLException(Code)
Returns a string representation of the input SQL statement sql expressed in the underlying system's native SQL syntax.
Parameters:
  sql - the JDBC form of an SQL statement. the SQL statement in native database format.
throws:
  SQLException - if there is a problem accessing the database



prepareCall
public CallableStatement prepareCall(String sql) throws SQLException(Code)
Returns a new instance of CallableStatement that may be used for making stored procedure calls to the database.
Parameters:
  sql - the SQL statement that calls the stored function a new instance of CallableStatement representingthe SQL statement. ResultSets emitted from thisCallableStatement will default to typeResultSet.TYPE_FORWARD_ONLY and concurrencyResultSet.CONCUR_READ_ONLY.
throws:
  SQLException - if a problem occurs accessing the database



prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException(Code)
Returns a new instance of CallableStatement that may be used for making stored procedure calls to the database. ResultSets emitted from this CallableStatement will satisfy the specified resultSetType and resultSetConcurrency values.
Parameters:
  sql - the SQL statement
Parameters:
  resultSetType - one of :
Parameters:
  resultSetConcurrency - one of : a new instance of CallableStatement representingthe precompiled SQL statement. ResultSets emittedfrom this CallableStatement will satisfy thespecified resultSetType andresultSetConcurrency values.
throws:
  SQLException - if a problem occurs accessing the database



prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code)
Returns a new instance of CallableStatement that may be used for making stored procedure calls to the database. ResultSets created from this CallableStatement will have characteristics determined by the specified type, concurrency and holdability arguments.
Parameters:
  sql - the SQL statement
Parameters:
  resultSetType - one of :
Parameters:
  resultSetConcurrency - one of :
Parameters:
  resultSetHoldability - one of : a new instance of CallableStatement representingthe precompiled SQL statement. ResultSets emittedfrom this CallableStatement will satisfy thespecified resultSetType,resultSetConcurrency andresultSetHoldability values.
throws:
  SQLException - if a problem occurs accessing the database



prepareStatement
public PreparedStatement prepareStatement(String sql) throws SQLException(Code)
Returns a new instance of PreparedStatement that 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. Alternatively, if the driver is not capable of flowing precompiled statements, the statement will not reach the database server until it is executed. This will have a bearing on precisely when SQLException instances get raised.

By default, ResultSets from the returned object will be ResultSet.TYPE_FORWARD_ONLY type with a ResultSet.CONCUR_READ_ONLY mode of concurrency.
Parameters:
  sql - the SQL statement. the PreparedStatement containing the supplied SQL statement
throws:
  SQLException - if there is a problem accessing the database




prepareStatement
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException(Code)
Creates a default PreparedStatement that can retrieve automatically generated keys. Parameter autoGeneratedKeys may be used to specify to the driver if such keys should be made accessible. This is only the case when sql is an insert statement.

An SQL statement which may have IN parameters can be stored and precompiled in a PreparedStatement. The PreparedStatement can 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. Alternatively, if the driver is not capable of flowing precompiled statements, the statement will not reach the database server until it is executed. This will have a bearing on precisely when SQLException instances get raised.

By default, ResultSets from the returned object will be ResultSet.TYPE_FORWARD_ONLY type with a ResultSet.CONCUR_READ_ONLY mode of concurrency.
Parameters:
  sql - the SQL statement.
Parameters:
  autoGeneratedKeys - one of :

a new PreparedStatement instance representing theinput SQL statement.
throws:
  SQLException - if there is a problem accessing the database



prepareStatement
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException(Code)
Creates a default PreparedStatement that can retrieve the auto-generated keys designated by a supplied array. If sql is an SQL INSERT statement, parameter columnIndexes is expected to hold the index values for each column in the statement's intended database table containing the autogenerated-keys of interest. Otherwise columnIndexes is 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 flowing precompiled statements, the statement will not reach the database server until it is executed. This will have a bearing on precisely when SQLException instances get raised.

By default, ResultSets from the returned object will be ResultSet.TYPE_FORWARD_ONLY type with a ResultSet.CONCUR_READ_ONLY mode of concurrency.
Parameters:
  sql - the SQL statement.
Parameters:
  columnIndexes - the indexes of the columns for which auto-generated keysshould be made available. the PreparedStatement containing the supplied SQL statement
throws:
  SQLException - if a problem occurs accessing the database




prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException(Code)
Creates a PreparedStatement that generates ResultSets with the specified values of resultSetType and resultSetConcurrency.
Parameters:
  sql - the SQL statement. It can contain one or more '?' IN parameterplaceholders
Parameters:
  resultSetType - one of :
Parameters:
  resultSetConcurrency - one of : a new instance of PreparedStatement containing theSQL statement sql. ResultSetsemitted from this PreparedStatement will satisfythe specified resultSetType andresultSetConcurrency values.
throws:
  SQLException - if a problem occurs accessing the database



prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code)
Creates a PreparedStatement that generates ResultSets with the specified type, concurrency and holdability
Parameters:
  sql - the SQL statement. It can contain one or more '?' IN parameterplaceholders
Parameters:
  resultSetType - one of :
Parameters:
  resultSetConcurrency - one of :
Parameters:
  resultSetHoldability - one of : a new instance of PreparedStatement containing theSQL statement sql. ResultSetsemitted from this PreparedStatement will satisfythe specified resultSetType,resultSetConcurrency andresultSetHoldability values.
throws:
  SQLException - if a problem occurs accessing the database



prepareStatement
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException(Code)
Creates a default PreparedStatement that can retrieve the auto-generated keys designated by a supplied array. If sql is an SQL INSERT statement, columnNames is expected to hold the names of each column in the statement's associated database table containing the autogenerated-keys of interest. Otherwise columnNames is 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 flowing precompiled statements, the statement will not reach the database server until it is executed. This will have a bearing on precisely when SQLException instances get raised.

By default, ResultSets from the returned object will be ResultSet.TYPE_FORWARD_ONLY type with a ResultSet.CONCUR_READ_ONLY mode of concurrency.
Parameters:
  sql - the SQL statement.
Parameters:
  columnNames - the names of the columns for which auto-generated keys shouldbe made available. the PreparedStatement containing the supplied SQL statement
throws:
  SQLException - if a problem occurs accessing the database




releaseSavepoint
public void releaseSavepoint(Savepoint savepoint) throws SQLException(Code)
Releases savepoint from the present transaction. Once removed, the Savepoint is considered invalid and should not be referenced further.
Parameters:
  savepoint - the object targeted for removal
throws:
  SQLException - if there is a problem with accessing the database or ifsavepoint is considered not valid in thistransaction.



rollback
public void rollback() throws SQLException(Code)
Rolls back all updates made so far in this transaction as well as relinquishing all acquired database locks. It is an error to invoke this operation when in auto-commit mode.
throws:
  SQLException - if there is a problem with the database or if the method iscalled while in auto-commit mode of operation.



rollback
public void rollback(Savepoint savepoint) throws SQLException(Code)
Undoes all changes made after the supplied Savepoint object was set. This method should only be used when auto-commit mode is disabled.
Parameters:
  savepoint - the Savepoint to roll back to
throws:
  SQLException - if there is a problem accessing the database



setAutoCommit
public void setAutoCommit(boolean autoCommit) throws SQLException(Code)
Sets this connection's auto-commit mode on or off.

Putting a Connection into auto-commit mode means that all associated SQL statements will be run and committed in their own separate transactions. Alternatively, auto-commit set to off means that associated SQL statements get grouped into transactions that need to be completed by explicit calls to either the Connection.commit() or Connection.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 complete 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.
Parameters:
  autoCommit - boolean indication of whether to put the target connectioninto auto-commit mode (true) or not (false)
throws:
  SQLException - if there is a problem accessing the database




setCatalog
public void setCatalog(String catalog) throws SQLException(Code)
Sets 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.
Parameters:
  catalog - the catalog name to use.
throws:
  SQLException - if there is a problem accessing the database



setHoldability
public void setHoldability(int holdability) throws SQLException(Code)
Sets the holdability of ResultSets created by this Connection.
Parameters:
  holdability - one of :
throws:
  SQLException - if there is a problem accessing the database



setReadOnly
public void setReadOnly(boolean readOnly) throws SQLException(Code)
Sets this connection to read-only mode.

This serves as a hint to the driver, which can enable database optimizations.
Parameters:
  readOnly - true to set the Connection to read only mode. false disablesread-only mode
throws:
  SQLException - if there is a problem accessing the database




setSavepoint
public Savepoint setSavepoint() throws SQLException(Code)
Creates an unnamed Savepoint in the current transaction. a Savepoint object for this savepoint.
throws:
  SQLException - if there is a problem accessing the database



setSavepoint
public Savepoint setSavepoint(String name) throws SQLException(Code)
Creates a named Savepoint in the current transaction.
Parameters:
  name - the name to use for the new Savepoint. a Savepoint object for this savepoint.
throws:
  SQLException - if there is a problem accessing the database



setTransactionIsolation
public void setTransactionIsolation(int level) throws SQLException(Code)
Sets the transaction isolation level for this Connection.

If this method is called during a transaction, the results are implementation defined.
Parameters:
  level - the new transaction isolation level to use from the followinglist of possible values :


throws:
  SQLException - if there is a problem with the database or if the value oflevel is not one of the expected constantvalues.



setTypeMap
public void setTypeMap(Map<String, Class<?>> map) throws SQLException(Code)
Sets the TypeMap for this connection. The input map should contain mappings between complex Java and SQL types.
Parameters:
  map - the new type map
throws:
  SQLException - if there is a problem accessing the database or ifmap is not an instance of Map.



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