|
Mimer JDBC Engine 2.12 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--com.mimer.jdbc.Connection
Connection represents a JDBC connection to a Mimer database server.
| Field Summary |
| Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
| Method Summary | |
void |
clearWarnings()
Clears all warnings reported on the object. |
void |
close()
Closes the connection. |
void |
commit()
Commits a transaction. |
Statement |
createStatement()
Creates a new Statement object. |
Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
Creates a new Statement object with specified scrollability and read/write mode. |
boolean |
getAutoCommit()
Checks if auto commit is enabled or not. |
String |
getCatalog()
Returns the current catalog of the connection. |
DatabaseMetaData |
getMetaData()
Returns a DatabaseMetaData object for this connection. |
Statistics |
getStatistics()
Return the Mimer connection statistics object. |
int |
getTransactionIsolation()
Returns the current transaction isolation. |
Map |
getTypeMap()
Returns the current type map associated with the current statement. |
SQLWarning |
getWarnings()
Returns the first warning posted to this object. |
boolean |
isClosed()
Returns true if the connection is closed. |
boolean |
isReadOnly()
Returns transaction readonly/readwrite status. |
String |
nativeSQL(String sql)
Converts any escape clauses in the statement. |
CallableStatement |
prepareCall(String sql)
Prepares a SQL statement with output parameters and creates a new CallableStatement object. |
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency)
Prepares a SQL statement with output parameters and creates a new CallableStatement object. |
PreparedStatement |
prepareStatement(String sql)
Prepares a SQL statement with input parameters and creates a new PreparedStatement object. |
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
Prepares a SQL statement with input parameters and creates a new PreparedStatement object. |
void |
rollback()
Rollbacks all changes made in the current transaction. |
void |
setAutoCommit(boolean autoCommit)
Sets the commit mode of the connection. |
void |
setCatalog(String catalog)
Changes the current catalog of the connection. |
void |
setReadOnly(boolean readOnly)
Alters the readonly state of transactions on this connection. |
void |
setTransactionIsolation(int level)
Alters the isolation of transactions on this connection. |
void |
setTypeMap(Map map)
Sets the current type map associated with the current statement. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.sql.Connection |
createStatement, getHoldability, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, setHoldability, setSavepoint, setSavepoint |
| Method Detail |
public void clearWarnings()
throws SQLException
clearWarnings in interface ConnectionSQLException - if an error occurs.
public void close()
throws SQLException
close in interface ConnectionSQLException - if a database error occurs. If an error occurs here, it is
most probably because some kind of server-client-communication error
occurred.
public void commit()
throws SQLException
Due to this feature of the optimistic concurrency control that Mimer employs, this is the only time when a transaction may fail. In a locking environment transactions may fail at any time because of deadlocks or simply because they timed out. A Mimer transaction never encounters a deadlock, nor will it ever time out.
If applications are expected to be portable, you should however make sure appropriate transaction error handling is covered everywhere.
Also see article on Optimistic Concurrency Control
commit in interface ConnectionSQLException - if a database error occurred. This could be because of two main
reasons. Either a client-server-communication error occurred, or the server was unable
to commit because of a transaction conflict. The latter will throw an SQLSTATE 40001.setAutoCommit(boolean),
getAutoCommit(),
rollback()
public Statement createStatement()
throws SQLException
createStatement in interface ConnectionSQLException - if an error occurs. The only runtime error likely to occur is
that the JVM was unable to instantiate the new object. If the connection is not open
SQLSTATE 08003 will be thrown.prepareCall(java.lang.String),
prepareStatement(java.lang.String)
public Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws SQLException
Performance consideration: Scrollable result sets are different from forward only result sets in that all rows once visited in the result remains stored in a temporary table on the server. A large scrollable result set may therefore consume a lot of memory on the server. The buildup of the temporary table mentioned will alone make a forward only result set faster than a scrollable result set.
createStatement in interface ConnectionresultSetType - Either ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE or
ResultSet.TYPE_SCROLL_INSENSITIVE. Mimer SQL supports only stable cursors, so ResultSet.TYPE_SCROLL_SENSITIVE
will default back to ResultSet.TYPE_SCROLL_INSENSITIVE.resultSetConcurrency - Either ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE. Mimer SQL
supports only updatable resultsets through the "UPDATE/DELETE WHERE CURRENT OF" SQL-statements.
SQLException - if an error occurs. The only runtime error likely to occur is
that the JVM was unable to instantiate the new object. If the connection is not open
SQLSTATE 08003 will be thrown.prepareCall(java.lang.String),
prepareStatement(java.lang.String)
public boolean getAutoCommit()
throws SQLException
getAutoCommit in interface ConnectionSQLException - if an error occurred. If the connection is not open SQLSTATE 08003 will be thrown.setAutoCommit(boolean)
public String getCatalog()
throws SQLException
getCatalog in interface ConnectionSQLException - if an error occurred. If the connection is not open SQLSTATE 08003 will be thrown.setCatalog(java.lang.String)
public DatabaseMetaData getMetaData()
throws SQLException
getMetaData in interface ConnectionSQLException - if an error occurred. If the connection is not open SQLSTATE 08003 will be thrown.public Statistics getStatistics()
public int getTransactionIsolation()
throws SQLException
getTransactionIsolation in interface ConnectionSQLException - if an error occurred. If the connection is not open SQLSTATE 08003 will be thrown.setTransactionIsolation(int)
public Map getTypeMap()
throws SQLException
Mimer JDBC does not currently support type maps. Whatever the current type map is, it is ignored during execution.
getTypeMap in interface ConnectionSQLException - if an error occurs.setTypeMap(java.util.Map)
public SQLWarning getWarnings()
throws SQLException
getWarnings in interface ConnectionSQLException - if an error occurred.clearWarnings()
public boolean isClosed()
throws SQLException
This routine this not test the connection. This will only return true if closed() has been called. Any connection problems will go unnoticed.
isClosed in interface ConnectionSQLException - if an error occurred.
public boolean isReadOnly()
throws SQLException
isReadOnly in interface ConnectionSQLException - if an error occurred. If the connection is not open SQLSTATE 08003 will be thrown.setReadOnly(boolean)
public String nativeSQL(String sql)
throws SQLException
Performance consideration: This call invokes the server preprocessor to expand the escape clauses. Escape clauses are expanded whenever statements are prepared, so this method is not needed for anything else than seeing what escape clauses actaully is expanded to on a Mimer SQL server.
nativeSQL in interface Connectionsql - SQL statement.
SQLException - if an error occurs. This request invokes the server and may therefore return many kind of errors. If the connection is not open SQLSTATE 08003 will be thrown.
public CallableStatement prepareCall(String sql)
throws SQLException
Although CallableStatements first come to mind when talking about procedure calls, any SQL statement that features output parameters must use a CallableStatement object.
prepareCall in interface Connectionsql - The SQL statement with the output parameters.
SQLException - if an error occurs. A compilation error will throw SQLSTATE 42000. If the connection is not open
SQLSTATE 08003 will be thrown.createStatement(),
prepareStatement(java.lang.String)
public CallableStatement prepareCall(String sql,
int resultSetType,
int resultSetConcurrency)
throws SQLException
Although CallableStatements first come to mind when talking about procedure calls, any SQL statement that features output parameters must use a CallableStatement object.
Performance consideration: Scrollable result sets are different from forward only result sets in that all rows once visited in the result remains stored in a temporary table on the server. A large scrollable result set may therefore consume a lot of memory on the server. The buildup of the temporary table mentioned will alone make a forward only result set faster than a scrollable result set.
prepareCall in interface Connectionsql - The SQL statement with the output parameters.resultSetType - Either ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE or
ResultSet.TYPE_SCROLL_INSENSITIVE. Mimer SQL supports only stable cursors, so ResultSet.TYPE_SCROLL_SENSITIVE
will default back to ResultSet.TYPE_SCROLL_INSENSITIVE.resultSetConcurrency - Either ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE. Mimer SQL
supports only updatable resultsets through the "UPDATE/DELETE WHERE CURRENT OF" SQL-statements.
SQLException - if an error occurs. A compilation error will throw SQLSTATE 42000. If the connection is not open
SQLSTATE 08003 will be thrown.createStatement(),
prepareStatement(java.lang.String)
public PreparedStatement prepareStatement(String sql)
throws SQLException
prepareStatement in interface Connectionsql - The SQL statement with the input parameters.
SQLException - if an error occurs. A compilation error will throw SQLSTATE 42000. If the connection is not open
SQLSTATE 08003 will be thrown.createStatement(),
prepareCall(java.lang.String)
public PreparedStatement prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
throws SQLException
Performance consideration: Scrollable result sets are different from forward only result sets in that all rows once visited in the result remains stored in a temporary table on the server. A large scrollable result set may therefore consume a lot of memory on the server. The buildup of the temporary table mentioned will alone make a forward only result set faster than a scrollable result set.
prepareStatement in interface Connectionsql - The SQL statement with the input parameters.resultSetType - Either ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE or
ResultSet.TYPE_SCROLL_INSENSITIVE. Mimer SQL supports only stable cursors, so ResultSet.TYPE_SCROLL_SENSITIVE
will default back to ResultSet.TYPE_SCROLL_INSENSITIVE.resultSetConcurrency - Either ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE. Mimer SQL
supports only updatable resultsets through the "UPDATE/DELETE WHERE CURRENT OF" SQL-statements.
SQLException - if an error occurs. A compilation error will throw SQLSTATE 42000. If the connection is not open
SQLSTATE 08003 will be thrown.createStatement(),
prepareCall(java.lang.String)
public void rollback()
throws SQLException
Since Mimer SQL stores uncommitted changes in a write set, which is logged and eventually written to database tables upon commit, a rollback will only throw away the current write set.
rollback in interface ConnectionSQLException - if a database error occurred. If the connection is not open
SQLSTATE 08003 will be thrown.
public void setAutoCommit(boolean autoCommit)
throws SQLException
If autocommit is enabled, every statement will run in a statement of its own. If autocommit is disabled (that is manual commit mode) the JDBC programmer has to explicitly tell the server to commit by calling the commit method.
Performance considerations: When the transaction is executing in autocommit mode, any changes made by a statement is independently secured on disk. This is in contrast to manual commit mode, where the server is not securing changes until the client explicitly says so by committing the transaction.
Therefore, server throughput during UPDATE/INSERT/DELETE operations benefits greatly from manual commit mode, where it is applicable.
A drawback of manual commit mode is that it requires an extra round-trip to the server at commit. The server knows in advance that a connection is in autocommit mode and can therefore commit at will.
When autocommit is turned on, the current transaction is committed.
setAutoCommit in interface ConnectionautoCommit - true for autocommit mode, false for manual commit mode
SQLException - if an error occurred. If the connection is not open
SQLSTATE 08003 will be thrown. If the commit failed, SQLSTATE 40001 is thrown.commit()
public void setCatalog(String catalog)
throws SQLException
Mimer SQL does not support the notion of catalogs, so setting this has no effect.
setCatalog in interface Connectioncatalog - The new catalog of the connection.
SQLException - if an error occurred. If the connection is not open SQLSTATE 08003 will be thrown.getCatalog()
public void setReadOnly(boolean readOnly)
throws SQLException
Performance consideration: A transaction running in read only mode will execute slightly faster because the server knows in advance that no database changes will be be made during the transaction.
Changing this attribute affects the next transaction on this connection.
setReadOnly in interface ConnectionreadOnly - true for read only mode.
SQLException - if an error occurred. If the connection is not open SQLSTATE 08003 will be thrown.isReadOnly()
public void setTransactionIsolation(int level)
throws SQLException
The transaction isolation level determines to what extent the transaction is seeing changes made by other transactions. As of Mimer SQL 9.1, only the two highest levels of isolation levels are supported (TRANSACTION_SERIALIZABLE and TRANSACTION_REPEATABLE_READ, the latter being the default).
setTransactionIsolation in interface Connectionlevel - The selected transaction isolation.
SQLException - if an error occurred. If the connection is not open SQLSTATE 08003 will be thrown.getTransactionIsolation()
public void setTypeMap(Map map)
throws SQLException
Mimer JDBC does not currently support type maps. Whatever the current type map is, it is ignored during execution.
setTypeMap in interface ConnectionSQLException - if an error occurs.getTypeMap()
|
Mimer JDBC Engine 2.12 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||