1 |
/* Connection.java -- Manage a database connection. |
/* Connection.java -- Manage a database connection. |
2 |
Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
41 |
import java.util.Map; |
import java.util.Map; |
42 |
|
|
43 |
/** |
/** |
44 |
* This interface provides methods for managing a connection to a database. |
* This interface provides methods for managing a connection to a database. |
45 |
* |
* |
46 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
47 |
*/ |
*/ |
48 |
public interface Connection |
public interface Connection |
49 |
{ |
{ |
50 |
|
/** |
51 |
|
* This transaction isolation level indicates that transactions are not |
52 |
|
* supported. |
53 |
|
*/ |
54 |
|
public static final int TRANSACTION_NONE = 0; |
55 |
|
|
56 |
|
/** |
57 |
|
* This transaction isolation level indicates that one transaction can |
58 |
|
* read modifications by other transactions before the other transactions |
59 |
|
* have committed their changes. This could result in invalid reads. |
60 |
|
*/ |
61 |
|
public static final int TRANSACTION_READ_UNCOMMITTED = 1; |
62 |
|
|
63 |
|
/** |
64 |
|
* This transaction isolation leve indicates that only committed data from |
65 |
|
* other transactions will be read. If a transaction reads a row, then |
66 |
|
* another transaction commits a change to that row, the first transaction |
67 |
|
* would retrieve the changed row on subsequent reads of the same row. |
68 |
|
*/ |
69 |
|
public static final int TRANSACTION_READ_COMMITTED = 2; |
70 |
|
|
71 |
|
/** |
72 |
|
* This transaction isolation level indicates that only committed data from |
73 |
|
* other transactions will be read. It also ensures that data read from |
74 |
|
* a row will not be different on a subsequent read even if another |
75 |
|
* transaction commits a change. |
76 |
|
*/ |
77 |
|
public static final int TRANSACTION_REPEATABLE_READ = 4; |
78 |
|
|
79 |
|
/** |
80 |
|
* This transaction isolation level indicates that only committed data from |
81 |
|
* other transactions will be read. It also ensures that data read from |
82 |
|
* a row will not be different on a subsequent read even if another |
83 |
|
* transaction commits a change. Additionally, rows modified by other |
84 |
|
* transactions will not affect the result set returned during subsequent |
85 |
|
* executions of the same WHERE clause in this transaction. |
86 |
|
*/ |
87 |
|
public static final int TRANSACTION_SERIALIZABLE = 8; |
88 |
|
|
89 |
|
/** |
90 |
|
* This method creates a new SQL statement. The default result set type |
91 |
|
* and concurrency will be used. |
92 |
|
* |
93 |
|
* @return A new <code>Statement</code> object. |
94 |
|
* @exception SQLException If an error occurs. |
95 |
|
* @see Statement |
96 |
|
*/ |
97 |
|
public Statement createStatement() throws SQLException; |
98 |
|
|
99 |
|
/** |
100 |
|
* This method creates a new <code>PreparedStatement</code> for the specified |
101 |
|
* SQL string. This method is designed for use with parameterized |
102 |
|
* statements. The default result set type and concurrency will be used. |
103 |
|
* |
104 |
|
* @param The SQL statement to use in creating this |
105 |
|
* <code>PreparedStatement</code>. |
106 |
|
* @return A new <code>PreparedStatement</code>. |
107 |
|
* @exception SQLException If an error occurs. |
108 |
|
* @see PreparedStatement |
109 |
|
*/ |
110 |
|
public PreparedStatement prepareStatement(String sql) throws SQLException; |
111 |
|
|
112 |
|
/** |
113 |
|
* This method creates a new <code>CallableStatement</code> for the |
114 |
|
* specified SQL string. Thie method is designed to be used with |
115 |
|
* stored procedures. The default result set type and concurrency |
116 |
|
* will be used. |
117 |
|
* |
118 |
|
* @param The SQL statement to use in creating this |
119 |
|
* <code>CallableStatement</code>. |
120 |
|
* @return A new <code>CallableStatement</code>. |
121 |
|
* @exception SQLException If an error occurs. |
122 |
|
* @see CallableStatement |
123 |
|
*/ |
124 |
|
public CallableStatement prepareCall(String sql) throws SQLException; |
125 |
|
|
126 |
|
/** |
127 |
|
* This method converts the specified generic SQL statement into the |
128 |
|
* native grammer of the database this object is connected to. |
129 |
|
* |
130 |
|
* @param The JDBC generic SQL statement. |
131 |
|
* @return The native SQL statement. |
132 |
|
* @exception SQLException If an error occurs. |
133 |
|
*/ |
134 |
|
public String nativeSQL(String sql) throws SQLException; |
135 |
|
|
136 |
|
/** |
137 |
|
* This method turns auto commit mode on or off. In auto commit mode, |
138 |
|
* every SQL statement is committed its own transaction. Otherwise a |
139 |
|
* transaction must be explicitly committed or rolled back. |
140 |
|
* |
141 |
|
* @param autoCommit <code>true</code> to enable auto commit mode, |
142 |
|
* <code>false</code> to disable it. |
143 |
|
* @exception SQLException If an error occurs. |
144 |
|
* @see commit |
145 |
|
* @see rollback |
146 |
|
*/ |
147 |
|
public void setAutoCommit(boolean autoCommit) throws SQLException; |
148 |
|
|
149 |
|
/** |
150 |
|
* This method tests whether or not auto commit mode is currently enabled. |
151 |
|
* In auto commit mode, every SQL statement is committed its own transaction. |
152 |
|
* Otherwise a transaction must be explicitly committed or rolled back. |
153 |
|
* |
154 |
|
* @return <code>true</code> if auto commit mode is enabled, |
155 |
|
* <code>false</code> otherwise. |
156 |
|
* |
157 |
|
* @exception SQLException If an error occurs. |
158 |
|
* |
159 |
|
* @see commit |
160 |
|
* @see rollback |
161 |
|
*/ |
162 |
|
public boolean getAutoCommit() throws SQLException; |
163 |
|
|
164 |
/** |
/** |
|
* This transaction isolation level indicates that transactions are not |
|
|
* supported. |
|
|
*/ |
|
|
public static final int TRANSACTION_NONE = 0; |
|
|
|
|
|
/** |
|
|
* This transaction isolation level indicates that one transaction can |
|
|
* read modifications by other transactions before the other transactions |
|
|
* have committed their changes. This could result in invalid reads. |
|
|
*/ |
|
|
public static final int TRANSACTION_READ_UNCOMMITTED = 1; |
|
|
|
|
|
/** |
|
|
* This transaction isolation leve indicates that only committed data from |
|
|
* other transactions will be read. If a transaction reads a row, then |
|
|
* another transaction commits a change to that row, the first transaction |
|
|
* would retrieve the changed row on subsequent reads of the same row. |
|
|
*/ |
|
|
public static final int TRANSACTION_READ_COMMITTED = 2; |
|
|
|
|
|
/** |
|
|
* This transaction isolation level indicates that only committed data from |
|
|
* other transactions will be read. It also ensures that data read from |
|
|
* a row will not be different on a subsequent read even if another |
|
|
* transaction commits a change. |
|
|
*/ |
|
|
public static final int TRANSACTION_REPEATABLE_READ = 4; |
|
|
|
|
|
/** |
|
|
* This transaction isolation level indicates that only committed data from |
|
|
* other transactions will be read. It also ensures that data read from |
|
|
* a row will not be different on a subsequent read even if another |
|
|
* transaction commits a change. Additionally, rows modified by other |
|
|
* transactions will not affect the result set returned during subsequent |
|
|
* executions of the same WHERE clause in this transaction. |
|
|
*/ |
|
|
public static final int TRANSACTION_SERIALIZABLE = 8; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method creates a new SQL statement. The default result set type |
|
|
* and concurrency will be used. |
|
|
* |
|
|
* @return A new <code>Statement</code> object. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
* |
|
|
* @see Statement |
|
|
*/ |
|
|
public abstract Statement |
|
|
createStatement() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method creates a new SQL statement with the specified type and |
|
|
* concurrency. Valid values for these parameters are specified in the |
|
|
* <code>ResultSet</code> class. |
|
|
* |
|
|
* @param resultSetType The type of result set to use for this statement. |
|
|
* @param resultSetConcurrency. The type of concurrency to be used in |
|
|
* the result set for this statement. |
|
|
* |
|
|
* @return A new <code>Statement</code> object. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
* |
|
|
* @see Statement |
|
|
* @see ResultSet |
|
|
*/ |
|
|
public abstract Statement |
|
|
createStatement(int resultSetType, int resultSetConcurrency) |
|
|
throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method creates a new <code>PreparedStatement</code> for the specified |
|
|
* SQL string. This method is designed for use with parameterized |
|
|
* statements. The default result set type and concurrency will be used. |
|
|
* |
|
|
* @param The SQL statement to use in creating this |
|
|
* <code>PreparedStatement</code>. |
|
|
* |
|
|
* @return A new <code>PreparedStatement</code>. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
* |
|
|
* @see PreparedStatement |
|
|
*/ |
|
|
public abstract PreparedStatement |
|
|
prepareStatement(String sql) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method creates a new <code>PreparedStatement</code> for the specified |
|
|
* SQL string. This method is designed for use with parameterized |
|
|
* statements. The specified result set type and concurrency will be used. |
|
|
* Valid values for these parameters are specified in the |
|
|
* <code>ResultSet</code> class. |
|
|
* |
|
|
* @param The SQL statement to use in creating this |
|
|
* <code>PreparedStatement</code>. |
|
|
* @param resultSetType The type of result set to use for this statement. |
|
|
* @param resultSetConcurrency. The type of concurrency to be used in |
|
|
* the result set for this statement. |
|
|
* |
|
|
* @return A new <code>PreparedStatement</code>. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
* |
|
|
* @see PreparedStatement |
|
|
* @see ResultSet |
|
|
*/ |
|
|
public abstract PreparedStatement |
|
|
prepareStatement(String sql, int resultSetType, int resultSetConcurrency) |
|
|
throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method creates a new <code>CallableStatement</code> for the |
|
|
* specified SQL string. Thie method is designed to be used with |
|
|
* stored procedures. The default result set type and concurrency |
|
|
* will be used. |
|
|
* |
|
|
* @param The SQL statement to use in creating this |
|
|
* <code>CallableStatement</code>. |
|
|
* |
|
|
* @return A new <code>CallableStatement</code>. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
* |
|
|
* @see CallableStatement |
|
|
*/ |
|
|
public abstract CallableStatement |
|
|
prepareCall(String sql) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method creates a new <code>CallableStatement</code> for the |
|
|
* specified SQL string. Thie method is designed to be used with |
|
|
* stored procedures. The specified result set type and concurrency |
|
|
* will be used. Valid values for these parameters are specified in the |
|
|
* <code>ResultSet</code> class. |
|
|
* |
|
|
* @param The SQL statement to use in creating this |
|
|
* <code>PreparedStatement</code>. |
|
|
* @param resultSetType The type of result set to use for this statement. |
|
|
* @param resultSetConcurrency. The type of concurrency to be used in |
|
|
* the result set for this statement. |
|
|
* |
|
|
* @return A new <code>CallableStatement</code>. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
* |
|
|
* @see CallableStatement |
|
|
* @see ResultSet |
|
|
*/ |
|
|
public abstract CallableStatement |
|
|
prepareCall(String sql, int resultSetType, int resultSetConcurrency) |
|
|
throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method converts the specified generic SQL statement into the |
|
|
* native grammer of the database this object is connected to. |
|
|
* |
|
|
* @param The JDBC generic SQL statement. |
|
|
* |
|
|
* @return The native SQL statement. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract String |
|
|
nativeSQL(String sql) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method tests whether or not auto commit mode is currently enabled. |
|
|
* In auto commit mode, every SQL statement is committed its own transaction. |
|
|
* Otherwise a transaction must be explicitly committed or rolled back. |
|
|
* |
|
|
* @return <code>true</code> if auto commit mode is enabled, |
|
|
* <code>false</code> otherwise. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
* |
|
|
* @see commit |
|
|
* @see rollback |
|
|
*/ |
|
|
public abstract boolean |
|
|
getAutoCommit() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method turns auto commit mode on or off. In auto commit mode, |
|
|
* every SQL statement is committed its own transaction. Otherwise a |
|
|
* transaction must be explicitly committed or rolled back. |
|
|
* |
|
|
* @param autoCommit <code>true</code> to enable auto commit mode, |
|
|
* <code>false</code> to disable it. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
* |
|
|
* @see commit |
|
|
* @see rollback |
|
|
*/ |
|
|
public abstract void |
|
|
setAutoCommit(boolean autoCommit) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
165 |
* This method commits any SQL statements executed on this connection since |
* This method commits any SQL statements executed on this connection since |
166 |
* the last commit or rollback. |
* the last commit or rollback. |
167 |
* |
* |
168 |
* @exception SQLException If an error occurs. |
* @exception SQLException If an error occurs. |
169 |
*/ |
*/ |
170 |
public abstract void |
public void commit() throws SQLException; |
|
commit() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method rolls back any SQL statements executed on this connection |
|
|
* since the last commit or rollback. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract void |
|
|
rollback() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method immediately closes this database connection. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract void |
|
|
close() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method tests whether or not this connection has been closed. |
|
|
* |
|
|
* @return <code>true</code> if the connection is closed, <code>false</code> |
|
|
* otherwise. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract boolean |
|
|
isClosed() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the meta data for this database connection. |
|
|
* |
|
|
* @return The meta data for this database. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
* |
|
|
* @see DatabaseMetaData |
|
|
*/ |
|
|
public abstract DatabaseMetaData |
|
|
getMetaData() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method tests whether or not this connection is in read only mode. |
|
|
* |
|
|
* @return <code>true</code> if the connection is read only <code>false</code> |
|
|
* otherwise. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract boolean |
|
|
isReadOnly() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method turns read only mode on or off. It may not be called while |
|
|
* a transaction is in progress. |
|
|
* |
|
|
* @param readOnly <code>true</code> if this connection is read only, |
|
|
* <code>false</code> otherwise. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract void |
|
|
setReadOnly(boolean readOnly) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the name of the catalog in use by this connection, |
|
|
* if any. |
|
|
* |
|
|
* @return The name of the catalog, or <code>null</code> if one does not |
|
|
* exist or catalogs are not supported by this database. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract String |
|
|
getCatalog() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method sets the name of the catalog in use by this connection. |
|
|
* Note that this method does nothing if catalogs are not supported by |
|
|
* this database. |
|
|
* |
|
|
* @param catalog The name of the catalog to use for this connection. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract void |
|
|
setCatalog(String catalog) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the current transaction isolation mode. This will |
|
|
* be one of the constants defined in this interface. |
|
|
* |
|
|
* @return The transaction isolation level. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract int |
|
|
getTransactionIsolation() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method sets the current transaction isolation mode. This must |
|
|
* be one of the constants defined in this interface. |
|
|
* |
|
|
* @param level The transaction isolation level. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract void |
|
|
setTransactionIsolation(int level) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the first warning that occurred on this connection, |
|
|
* if any. If there were any subsequence warnings, they will be chained |
|
|
* to the first one. |
|
|
* |
|
|
* @return The first <code>SQLWarning</code> that occurred, or |
|
|
* <code>null</code> if there have been no warnings. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract SQLWarning |
|
|
getWarnings() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method clears all warnings that have occurred on this connection. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract void |
|
|
clearWarnings() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the mapping of SQL types to Java classes |
|
|
* currently in use by this connection. This mapping will have no |
|
|
* entries unless they have been manually added. |
|
|
* |
|
|
* @return The SQL type to Java class mapping. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract Map |
|
|
getTypeMap() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method sets the mapping table for SQL types to Java classes. |
|
|
* Any entries in this map override the defaults. |
|
|
* |
|
|
* @param map The new SQL mapping table. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract void |
|
|
setTypeMap(Map map) throws SQLException; |
|
|
|
|
|
} // interface Connection |
|
171 |
|
|
172 |
|
/** |
173 |
|
* This method rolls back any SQL statements executed on this connection |
174 |
|
* since the last commit or rollback. |
175 |
|
* |
176 |
|
* @exception SQLException If an error occurs. |
177 |
|
*/ |
178 |
|
public void rollback() throws SQLException; |
179 |
|
|
180 |
|
/** |
181 |
|
* This method immediately closes this database connection. |
182 |
|
* |
183 |
|
* @exception SQLException If an error occurs. |
184 |
|
*/ |
185 |
|
public void close() throws SQLException; |
186 |
|
|
187 |
|
/** |
188 |
|
* This method tests whether or not this connection has been closed. |
189 |
|
* |
190 |
|
* @return <code>true</code> if the connection is closed, <code>false</code> |
191 |
|
* otherwise. |
192 |
|
* @exception SQLException If an error occurs. |
193 |
|
*/ |
194 |
|
public boolean isClosed() throws SQLException; |
195 |
|
|
196 |
|
/** |
197 |
|
* This method returns the meta data for this database connection. |
198 |
|
* |
199 |
|
* @return The meta data for this database. |
200 |
|
* @exception SQLException If an error occurs. |
201 |
|
* @see DatabaseMetaData |
202 |
|
*/ |
203 |
|
public DatabaseMetaData getMetaData() throws SQLException; |
204 |
|
|
205 |
|
/** |
206 |
|
* This method turns read only mode on or off. It may not be called while |
207 |
|
* a transaction is in progress. |
208 |
|
* |
209 |
|
* @param readOnly <code>true</code> if this connection is read only, |
210 |
|
* <code>false</code> otherwise. |
211 |
|
* @exception SQLException If an error occurs. |
212 |
|
*/ |
213 |
|
public void setReadOnly(boolean readOnly) throws SQLException; |
214 |
|
|
215 |
|
/** |
216 |
|
* This method tests whether or not this connection is in read only mode. |
217 |
|
* |
218 |
|
* @return <code>true</code> if the connection is read only <code>false</code> |
219 |
|
* otherwise. |
220 |
|
* @exception SQLException If an error occurs. |
221 |
|
*/ |
222 |
|
public boolean isReadOnly() throws SQLException; |
223 |
|
|
224 |
|
/** |
225 |
|
* This method sets the name of the catalog in use by this connection. |
226 |
|
* Note that this method does nothing if catalogs are not supported by |
227 |
|
* this database. |
228 |
|
* |
229 |
|
* @param catalog The name of the catalog to use for this connection. |
230 |
|
* @exception SQLException If an error occurs. |
231 |
|
*/ |
232 |
|
public void setCatalog(String catalog) throws SQLException; |
233 |
|
|
234 |
|
/** |
235 |
|
* This method returns the name of the catalog in use by this connection, |
236 |
|
* if any. |
237 |
|
* |
238 |
|
* @return The name of the catalog, or <code>null</code> if one does not |
239 |
|
* exist or catalogs are not supported by this database. |
240 |
|
* @exception SQLException If an error occurs. |
241 |
|
*/ |
242 |
|
public String getCatalog() throws SQLException; |
243 |
|
|
244 |
|
/** |
245 |
|
* This method sets the current transaction isolation mode. This must |
246 |
|
* be one of the constants defined in this interface. |
247 |
|
* |
248 |
|
* @param level The transaction isolation level. |
249 |
|
* @exception SQLException If an error occurs. |
250 |
|
*/ |
251 |
|
public void setTransactionIsolation(int level) throws SQLException; |
252 |
|
|
253 |
|
/** |
254 |
|
* This method returns the current transaction isolation mode. This will |
255 |
|
* be one of the constants defined in this interface. |
256 |
|
* |
257 |
|
* @return The transaction isolation level. |
258 |
|
* @exception SQLException If an error occurs. |
259 |
|
*/ |
260 |
|
public int getTransactionIsolation() throws SQLException; |
261 |
|
|
262 |
|
/** |
263 |
|
* This method returns the first warning that occurred on this connection, |
264 |
|
* if any. If there were any subsequence warnings, they will be chained |
265 |
|
* to the first one. |
266 |
|
* |
267 |
|
* @return The first <code>SQLWarning</code> that occurred, or |
268 |
|
* <code>null</code> if there have been no warnings. |
269 |
|
* @exception SQLException If an error occurs. |
270 |
|
*/ |
271 |
|
public SQLWarning getWarnings() throws SQLException; |
272 |
|
|
273 |
|
/** |
274 |
|
* This method clears all warnings that have occurred on this connection. |
275 |
|
* |
276 |
|
* @exception SQLException If an error occurs. |
277 |
|
*/ |
278 |
|
public void clearWarnings() throws SQLException; |
279 |
|
|
280 |
|
/** |
281 |
|
* This method creates a new SQL statement with the specified type and |
282 |
|
* concurrency. Valid values for these parameters are specified in the |
283 |
|
* <code>ResultSet</code> class. |
284 |
|
* |
285 |
|
* @param resultSetType The type of result set to use for this statement. |
286 |
|
* @param resultSetConcurrency. The type of concurrency to be used in |
287 |
|
* the result set for this statement. |
288 |
|
* @return A new <code>Statement</code> object. |
289 |
|
* @exception SQLException If an error occurs. |
290 |
|
* @see Statement |
291 |
|
* @see ResultSet |
292 |
|
*/ |
293 |
|
public Statement createStatement(int resultSetType, int resultSetConcurrency) |
294 |
|
throws SQLException; |
295 |
|
|
296 |
|
/** |
297 |
|
* This method creates a new <code>PreparedStatement</code> for the specified |
298 |
|
* SQL string. This method is designed for use with parameterized |
299 |
|
* statements. The specified result set type and concurrency will be used. |
300 |
|
* Valid values for these parameters are specified in the |
301 |
|
* <code>ResultSet</code> class. |
302 |
|
* |
303 |
|
* @param The SQL statement to use in creating this |
304 |
|
* <code>PreparedStatement</code>. |
305 |
|
* @param resultSetType The type of result set to use for this statement. |
306 |
|
* @param resultSetConcurrency. The type of concurrency to be used in |
307 |
|
* the result set for this statement. |
308 |
|
* @return A new <code>PreparedStatement</code>. |
309 |
|
* @exception SQLException If an error occurs. |
310 |
|
* @see PreparedStatement |
311 |
|
* @see ResultSet |
312 |
|
*/ |
313 |
|
public PreparedStatement prepareStatement(String sql, int resultSetType, |
314 |
|
int resultSetConcurrency) throws SQLException; |
315 |
|
|
316 |
|
/** |
317 |
|
* This method creates a new <code>CallableStatement</code> for the |
318 |
|
* specified SQL string. Thie method is designed to be used with |
319 |
|
* stored procedures. The specified result set type and concurrency |
320 |
|
* will be used. Valid values for these parameters are specified in the |
321 |
|
* <code>ResultSet</code> class. |
322 |
|
* |
323 |
|
* @param The SQL statement to use in creating this |
324 |
|
* <code>PreparedStatement</code>. |
325 |
|
* @param resultSetType The type of result set to use for this statement. |
326 |
|
* @param resultSetConcurrency. The type of concurrency to be used in |
327 |
|
* the result set for this statement. |
328 |
|
* @return A new <code>CallableStatement</code>. |
329 |
|
* @exception SQLException If an error occurs. |
330 |
|
* @see CallableStatement |
331 |
|
* @see ResultSet |
332 |
|
*/ |
333 |
|
public CallableStatement prepareCall(String sql, int resultSetType, int |
334 |
|
resultSetConcurrency) throws SQLException; |
335 |
|
|
336 |
|
/** |
337 |
|
* This method returns the mapping of SQL types to Java classes |
338 |
|
* currently in use by this connection. This mapping will have no |
339 |
|
* entries unless they have been manually added. |
340 |
|
* |
341 |
|
* @return The SQL type to Java class mapping. |
342 |
|
* @exception SQLException If an error occurs. |
343 |
|
*/ |
344 |
|
public Map getTypeMap() throws SQLException; |
345 |
|
|
346 |
|
/** |
347 |
|
* This method sets the mapping table for SQL types to Java classes. |
348 |
|
* Any entries in this map override the defaults. |
349 |
|
* |
350 |
|
* @param map The new SQL mapping table. |
351 |
|
* @exception SQLException If an error occurs. |
352 |
|
*/ |
353 |
|
public void setTypeMap(Map map) throws SQLException; |
354 |
|
|
355 |
|
/** |
356 |
|
* @since 1.4 |
357 |
|
*/ |
358 |
|
public void setHoldability(int holdability) throws SQLException; |
359 |
|
|
360 |
|
/** |
361 |
|
* @since 1.4 |
362 |
|
*/ |
363 |
|
public int getHoldability() throws SQLException; |
364 |
|
|
365 |
|
/** |
366 |
|
* @since 1.4 |
367 |
|
*/ |
368 |
|
public Savepoint setSavepoint() throws SQLException; |
369 |
|
|
370 |
|
/** |
371 |
|
* @since 1.4 |
372 |
|
*/ |
373 |
|
public Savepoint setSavepoint(String name) throws SQLException; |
374 |
|
|
375 |
|
/** |
376 |
|
* @since 1.4 |
377 |
|
*/ |
378 |
|
public void rollback(Savepoint savepoint) throws SQLException; |
379 |
|
|
380 |
|
/** |
381 |
|
* @since 1.4 |
382 |
|
*/ |
383 |
|
public void releaseSavepoint(Savepoint savepoint) throws SQLException; |
384 |
|
|
385 |
|
/** |
386 |
|
* @since 1.4 |
387 |
|
*/ |
388 |
|
public Statement createStatement(int resultSetType, int |
389 |
|
resultSetConcurrency, int resultSetHoldability) throws SQLException; |
390 |
|
|
391 |
|
/** |
392 |
|
* @since 1.4 |
393 |
|
*/ |
394 |
|
public PreparedStatement prepareStatement(String sql, int resultSetType, int |
395 |
|
resultSetConcurrency, int resultSetHoldability) throws SQLException; |
396 |
|
|
397 |
|
/** |
398 |
|
* @since 1.4 |
399 |
|
*/ |
400 |
|
public CallableStatement prepareCall(String sql, int resultSetType, int |
401 |
|
resultSetConcurrency, int resultSetHoldability) throws SQLException; |
402 |
|
|
403 |
|
/** |
404 |
|
* @since 1.4 |
405 |
|
*/ |
406 |
|
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) |
407 |
|
throws SQLException; |
408 |
|
|
409 |
|
/** |
410 |
|
* @since 1.4 |
411 |
|
*/ |
412 |
|
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) |
413 |
|
throws SQLException; |
414 |
|
|
415 |
|
/** |
416 |
|
* @since 1.4 |
417 |
|
*/ |
418 |
|
public PreparedStatement prepareStatement(String sql, String[] columnNames) |
419 |
|
throws SQLException; |
420 |
|
} |