|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.metamatrix.jdbc.WrapperImpl com.metamatrix.jdbc.MMConnection
public abstract class MMConnection
The Connection object represents driver's connection to the MetaMatrix embedded server. This object provides a way for SQL statements to be sent to the MetaMatrix embedded server and return results. Information about the databases (metadata) accessed by MetaMatrix server is retrieved via the getMetaData method. Upon creation, the new connection object is in auto-commit mode, so after a statement is executed it is immediately committed to the server. If the connection sets auto-commit to false, a commit statement on the Connection object must be called to ensure that the data is saved to the MetaMatrix server. The Connection object's close method will disconnect from the MetaMatrix server, free up any resources that it has allocated, and set it's internal attribute of isClosed to true. All the methods in the class throw SQLException.
Field Summary | |
---|---|
protected java.util.Properties |
propInfo
|
protected ServerConnection |
serverConn
|
Fields inherited from interface java.sql.Connection |
---|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Constructor Summary | |
---|---|
MMConnection(ServerConnection serverConn,
java.util.Properties info,
java.lang.String url)
MMConnection constructor, tring to establish connection to metamatrix with the given URL and properties. |
Method Summary | |
---|---|
void |
clearWarnings()
This method clears all warnings reported for this object. |
void |
close()
This method will release the MMDriverConnection's connection to the server and all resources immediately instead of waiting for them to be automatically released. |
void |
commit()
This method makes any changes involved in a transaction permanent and releases any locks held by the connection object. |
protected void |
commitTransaction(MMXid arg0,
boolean arg1)
|
java.sql.Array |
createArrayOf(java.lang.String typeName,
java.lang.Object[] elements)
|
java.sql.Blob |
createBlob()
|
java.sql.Clob |
createClob()
|
java.sql.NClob |
createNClob()
|
java.sql.SQLXML |
createSQLXML()
|
java.sql.Statement |
createStatement()
This creates a MMStatement object for sending SQL statements to the MetaMatrix server. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
Creates a Statement object that will produce ResultSet objects of the type resultSetType and concurrency level resultSetConcurrency. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
java.sql.Struct |
createStruct(java.lang.String typeName,
java.lang.Object[] attributes)
|
protected void |
endTransaction(MMXid arg0,
int arg1)
|
protected void |
forgetTransaction(MMXid arg0)
|
boolean |
getAutoCommit()
This method returns the current status of the connection in regards to it's auto-commit state. |
abstract BaseDriver |
getBaseDriver()
|
java.lang.String |
getCatalog()
There is no concept of catalog in JDBC and this method returns a null. |
java.util.Properties |
getClientInfo()
|
java.lang.String |
getClientInfo(java.lang.String name)
|
java.lang.String |
getConnectionId()
Connection identifier of this connection |
abstract java.lang.String |
getDatabaseName()
Get the database name that this connection is representing |
int |
getHoldability()
Retrieves the current holdability of ResultSet objects created using this Connection object. |
java.sql.DatabaseMetaData |
getMetaData()
|
int |
getTransactionIsolation()
Return the corresponding java.sql.Connection Transaction isolation level that this connection is currently set to. |
protected MMXid |
getTransactionXid()
|
java.util.Map |
getTypeMap()
Retreives the type map associated with this Connection object. |
java.sql.SQLWarning |
getWarnings()
This method will return the first warning reported by calls on this connection, or null if none exist. |
boolean |
isClosed()
This method will return whether this connection is closed or not. |
boolean |
isReadOnly()
This method will return whether this connection is read only or not. |
abstract boolean |
isSameProcess(MMConnection conn)
|
boolean |
isValid(int timeout)
|
java.lang.String |
nativeSQL(java.lang.String sql)
This method will convert the given SQL String into a MetaMatrix SQL Request. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
Creates a CallableStatement object that contains sql and that will produce ResultSet objects that are non-scrollable and non-updatable. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Creates a CallableStatement object that contains a sql and that will produce ResultSet objects of the type resultSetType and with a concurrency level of resultSetConcurrency. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
This method creates a MMPreparedStatement which is used for sending parameterized SQL statements to the MetaMatrix server. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] columnIndexes)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Creates a PreparedStatement object that contains a sql and that will produce ResultSet objects of the type resultSetType and with a concurrency level of resultSetConcurrency. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
This method creates a MMPreparedStatement which is used for sending parameterized SQL statements to the MetaMatrix server and it has the capability to retrieve auto-generated keys. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
|
protected int |
prepareTransaction(MMXid arg0)
|
protected javax.transaction.xa.Xid[] |
recoverTransaction(int arg0)
|
void |
recycleConnection()
|
void |
releaseSavepoint(java.sql.Savepoint savepoint)
|
void |
rollback()
This method will drop all changes made since the beginning of the transaction and release any MetaMatrix server locks currently held by this connection. |
void |
rollback(java.sql.Savepoint savepoint)
|
protected void |
rollbackTransaction(MMXid arg0)
|
void |
setAutoCommit(boolean autoCommit)
This method will set the connection's auto commit mode accordingly. |
void |
setCatalog(java.lang.String catalog)
Metamatrix does not allow setting a catalog through a connection. |
void |
setClientInfo(java.util.Properties properties)
|
void |
setClientInfo(java.lang.String name,
java.lang.String value)
|
void |
setHoldability(int holdability)
|
void |
setReadOnly(boolean readOnly)
|
java.sql.Savepoint |
setSavepoint()
|
java.sql.Savepoint |
setSavepoint(java.lang.String name)
|
void |
setTransactionIsolation(int level)
|
void |
setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
|
protected void |
startTransaction(MMXid arg0,
int arg1,
int timeout)
|
Methods inherited from class com.metamatrix.jdbc.WrapperImpl |
---|
isWrapperFor, unwrap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.metamatrix.jdbc.api.Connection |
---|
getAdminAPI |
Methods inherited from interface java.sql.Wrapper |
---|
isWrapperFor, unwrap |
Field Detail |
---|
protected java.util.Properties propInfo
protected ServerConnection serverConn
Constructor Detail |
---|
public MMConnection(ServerConnection serverConn, java.util.Properties info, java.lang.String url)
MMConnection constructor, tring to establish connection to metamatrix with the given URL and properties.
serverConn
- connection standing for client to MetaMatrix Serverinfo
- contains properies needed to establish a MetaMatrix connection.
java.sql.SQLException
- if the driver cannot establish connection to metamatrix.Method Detail |
---|
public java.lang.String getConnectionId()
java.sql.SQLException
public void clearWarnings() throws java.sql.SQLException
This method clears all warnings reported for this object. After this method is called, the corresponding method of getWarnings() will return null. This returns a null, as we have no warnings thrown from the MetaMatrix server.
clearWarnings
in interface java.sql.Connection
java.sql.SQLException
- should never happen.public void close() throws java.sql.SQLException
This method will release the MMDriverConnection's connection to the server and all resources immediately instead of waiting for them to be automatically released. Fatal errors will close a connection as will a garbage collection on this object.
close
in interface java.sql.Connection
java.sql.SQLException
- if a MetaMatrix server access error occurs.public void commit() throws java.sql.SQLException
This method makes any changes involved in a transaction permanent and releases any locks held by the connection object. This is only used when auto-commit is set to false.
commit
in interface java.sql.Connection
java.sql.SQLException
- if the transaction had been rolled back or marked to roll back.public java.sql.Statement createStatement() throws java.sql.SQLException
This creates a MMStatement object for sending SQL statements to the MetaMatrix server. This should be used for statements without parameters. For statements that are executed many times, use the PreparedStatement object.
createStatement
in interface java.sql.Connection
a
- SQLException if a MetaMatrix server access error occurs.
java.sql.SQLException
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
Creates a Statement object that will produce ResultSet objects of the type resultSetType and concurrency level resultSetConcurrency.
createStatement
in interface java.sql.Connection
intvalue
- indicating the ResultSet's typeintValue
- indicating the ResultSet's concurrency
java.sql.SQLException
public boolean getAutoCommit() throws java.sql.SQLException
This method returns the current status of the connection in regards to it's auto-commit state. By default, the auto-commit is set to true. Meaning that any transaction that occurs is automatically commited to the MetaMatrix server. #See corresponding setAutoCommit() method.
getAutoCommit
in interface java.sql.Connection
java.sql.SQLException
- should never happenpublic java.lang.String getCatalog() throws java.sql.SQLException
There is no concept of catalog in JDBC and this method returns a null.
getCatalog
in interface java.sql.Connection
SQLException,
- should never occur.
java.sql.SQLException
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
getMetaData
in interface java.sql.Connection
java.sql.SQLException
public abstract java.lang.String getDatabaseName()
public int getHoldability() throws java.sql.SQLException
getHoldability
in interface java.sql.Connection
holdability
- int indicating the holdability
java.sql.SQLException
public int getTransactionIsolation() throws java.sql.SQLException
getTransactionIsolation
in interface java.sql.Connection
java.sql.SQLException
public java.util.Map getTypeMap() throws java.sql.SQLException
getTypeMap
in interface java.sql.Connection
SQLException,
- should never occur
java.sql.SQLException
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
This method will return the first warning reported by calls on this connection, or null if none exist.
getWarnings
in interface java.sql.Connection
SQLException,
- should never occur
java.sql.SQLException
public boolean isClosed() throws java.sql.SQLException
This method will return whether this connection is closed or not.
isClosed
in interface java.sql.Connection
SQLException,
- should never occur
java.sql.SQLException
public boolean isReadOnly() throws java.sql.SQLException
This method will return whether this connection is read only or not. It will throw a SQLException if a MetaMatrix server access error occurs.
isReadOnly
in interface java.sql.Connection
SQLException,
- should never occur
java.sql.SQLException
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLException
This method will convert the given SQL String into a MetaMatrix SQL Request. This will convert any date escape sequences into the appropriate MetaMatrix type, and any kind of data transformations that the MetaMatrix server would expect. This method returns the native form of the statement that the driver would have sent.
nativeSQL
in interface java.sql.Connection
sql
- string to be coverted into SQL understood by metamatrix
SQLException,
- should never occur
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
Creates a CallableStatement object that contains sql and that will produce ResultSet objects that are non-scrollable and non-updatable. A SQL stored procedure call statement is handled by creating a CallableStatement for it.
prepareCall
in interface java.sql.Connection
sql
- String(escape syntax) for invoking a stored procedure.
java.sql.SQLException
- if there is an error creating the callable statement objectpublic java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
Creates a CallableStatement object that contains a sql and that will produce ResultSet objects of the type resultSetType and with a concurrency level of resultSetConcurrency. A SQL stored procedure call statement is handled by creating a CallableStatement for it.
prepareCall
in interface java.sql.Connection
sql
- String(escape syntax) for invoking a stored procedure.intvalue
- indicating the ResultSet's typeintValue
- indicating the ResultSet's concurrency
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
This method creates a MMPreparedStatement which is used for sending parameterized SQL statements to the MetaMatrix server. A statement with or without IN parameters can be pre-compiled and stored in a MMPreparedStatement object. Since the MetaMatrix server does not pre-compile statements, a sql statement will be constructed using the parameters supplied which would be used for execution of this preparedStatement object.
prepareStatement
in interface java.sql.Connection
sql
- string representing a prepared statement
java.sql.SQLException
- if there is an error creating a prepared statement objectpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
Creates a PreparedStatement object that contains a sql and that will produce ResultSet objects of the type resultSetType and with a concurrency level of resultSetConcurrency.
prepareStatement
in interface java.sql.Connection
sql
- string representing a prepared statementintvalue
- indicating the ResultSet's typeintValue
- indicating the ResultSet's concurrency
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
This method creates a MMPreparedStatement which is used for sending parameterized SQL statements to the MetaMatrix server and it has the capability to retrieve auto-generated keys.
prepareStatement
in interface java.sql.Connection
sql
- string representing a prepared statementintValue
- indicating the result set TypeintValue
- indicating the result set concurrencyintValue
- indicating the result set holdability
java.sql.SQLException
- if there is an error creating a prepared statement objectpublic void rollback() throws java.sql.SQLException
This method will drop all changes made since the beginning of the transaction and release any MetaMatrix server locks currently held by this connection. This method rolls back transactions on all the statements currently open on this connection. This is used when then auto-commit has been disabled.
rollback
in interface java.sql.Connection
java.sql.SQLException
- if there is an error rolling back.method for more information.
public void setAutoCommit(boolean autoCommit) throws java.sql.SQLException
This method will set the connection's auto commit mode accordingly. By default this is set to true (auto-commit is turned on). An auto-commit value of true means any statements will automatically be made permanent if they are successful after the last row of the ReulstSet has been retrieved or the next execute occurs, whichever comes first. If set to false, changes can be either be committed (using the commit() method) or rolled back ("undo the changes" by using the rollback() method).
setAutoCommit
in interface java.sql.Connection
boolean
- value indicating if autoCommit is turned on
java.sql.SQLException
- is metamatrix access error occurs.public void setCatalog(java.lang.String catalog) throws java.sql.SQLException
Metamatrix does not allow setting a catalog through a connection. This method silently ignores the request as per the specification.
setCatalog
in interface java.sql.Connection
The
- string values which sets the catalog name on the connection.
java.sql.SQLException
- This should never occur.public void setReadOnly(boolean readOnly) throws java.sql.SQLException
setReadOnly
in interface java.sql.Connection
A
- boolean value specifying whether the connection is readonly.
throws
- SQLException.
java.sql.SQLException
protected void commitTransaction(MMXid arg0, boolean arg1) throws java.sql.SQLException
java.sql.SQLException
protected void endTransaction(MMXid arg0, int arg1) throws java.sql.SQLException
java.sql.SQLException
protected void forgetTransaction(MMXid arg0) throws java.sql.SQLException
java.sql.SQLException
protected int prepareTransaction(MMXid arg0) throws java.sql.SQLException
java.sql.SQLException
protected javax.transaction.xa.Xid[] recoverTransaction(int arg0) throws java.sql.SQLException
java.sql.SQLException
protected void rollbackTransaction(MMXid arg0) throws java.sql.SQLException
java.sql.SQLException
protected void startTransaction(MMXid arg0, int arg1, int timeout) throws java.sql.SQLException
java.sql.SQLException
protected MMXid getTransactionXid()
public boolean isValid(int timeout) throws java.sql.SQLException
isValid
in interface java.sql.Connection
java.sql.SQLException
public void recycleConnection()
public abstract BaseDriver getBaseDriver()
public abstract boolean isSameProcess(MMConnection conn) throws CommunicationException
CommunicationException
public void setClientInfo(java.util.Properties properties) throws java.sql.SQLClientInfoException
setClientInfo
in interface java.sql.Connection
java.sql.SQLClientInfoException
public void setClientInfo(java.lang.String name, java.lang.String value) throws java.sql.SQLClientInfoException
setClientInfo
in interface java.sql.Connection
java.sql.SQLClientInfoException
public java.util.Properties getClientInfo() throws java.sql.SQLException
getClientInfo
in interface java.sql.Connection
java.sql.SQLException
public java.lang.String getClientInfo(java.lang.String name) throws java.sql.SQLException
getClientInfo
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Array createArrayOf(java.lang.String typeName, java.lang.Object[] elements) throws java.sql.SQLException
createArrayOf
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Blob createBlob() throws java.sql.SQLException
createBlob
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Clob createClob() throws java.sql.SQLException
createClob
in interface java.sql.Connection
java.sql.SQLException
public java.sql.NClob createNClob() throws java.sql.SQLException
createNClob
in interface java.sql.Connection
java.sql.SQLException
public java.sql.SQLXML createSQLXML() throws java.sql.SQLException
createSQLXML
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Struct createStruct(java.lang.String typeName, java.lang.Object[] attributes) throws java.sql.SQLException
createStruct
in interface java.sql.Connection
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
public void releaseSavepoint(java.sql.Savepoint savepoint) throws java.sql.SQLException
releaseSavepoint
in interface java.sql.Connection
java.sql.SQLException
public void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLException
rollback
in interface java.sql.Connection
java.sql.SQLException
public void setHoldability(int holdability) throws java.sql.SQLException
setHoldability
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Savepoint setSavepoint() throws java.sql.SQLException
setSavepoint
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Savepoint setSavepoint(java.lang.String name) throws java.sql.SQLException
setSavepoint
in interface java.sql.Connection
java.sql.SQLException
public void setTransactionIsolation(int level) throws java.sql.SQLException
setTransactionIsolation
in interface java.sql.Connection
java.sql.SQLException
public void setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map) throws java.sql.SQLException
setTypeMap
in interface java.sql.Connection
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |