All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.imaginary.sql.msql.MsqlConnection

com.imaginary.sql.msql.MsqlConnection

public class MsqlConnection
The MsqlConnection class is an implementation of the JDBC Connection interface that represents a database transaction. This class should never be directly instantiated by an application, but instead should be gotten by calling DriverManager.getConnection().
Last modified $Date: 1999/07/09 23:16:25 $

Version:
$Revision: 1.1.2.1.2.2 $
Author:
George Reese (borg@imaginary.com)
See Also:
getConnection

Variable Index

 o database
 o input
 o output
 o url
 o user
 o version
 o versionString

Method Index

 o clearWarnings()
Since mSQL produces no warnings, this is a NO-OP
 o close()
Closes this database connection.
 o commit()
This is a NO-OP for mSQL.
 o createStatement()
This JDBC method creates an instance of MsqlStatement that is forward-only and read-only.
 o getAutoCommit()
This method always returns true since mSQL is always in auto-commit mode.
 o getCatalog()
Provides the catalog name.
 o getEncoding()
 o getMetaData()
Provides meta-data for the database connection.
 o getTransactionIsolation()
 o getUser()
 o getWarnings()
mSQL does not have warnings.
 o isClosed()
 o isReadOnly()
mSQL does not support read only connections, only read-only access rights.
 o nativeSQL(String)
This gives the driver an opportunity to turn JDBC compliant SQL into mSQL specific SQL.
 o prepareCall(String)
Callable statements are not supported by mSQL.
 o prepareStatement(String)
Constructs a PreparedStatement matching the specified statement.
 o rollback()
This method always errors since you cannot rollback an mSQL transaction.
 o setAutoCommit(boolean)
This method will thrown an exception if you try to turn auto-commit off since JDBC does not support transactional logic.
 o setCatalog(String)
Selects the database to be used by this connection.
 o setReadOnly(boolean)
mSQL does not support read-only mode.
 o setTransactionIsolation(int)
This is not supported by mSQL, thus this is a NO-OP.

Variables

 o database
 protected String database
 o input
 protected MsqlInputStream input
 o output
 protected MsqlOutputStream output
 o url
 protected String url
 o user
 protected String user
 o version
 protected int version
 o versionString
 protected String versionString

Methods

 o clearWarnings
 public void clearWarnings() throws SQLException
Since mSQL produces no warnings, this is a NO-OP

Throws: SQLException
this is never thrown
 o close
 public synchronized void close() throws SQLException
Closes this database connection. It will also close any associated Statement instances.

Throws: SQLException
thrown if problems occur
 o commit
 public void commit() throws SQLException
This is a NO-OP for mSQL. All statements are always auto-committed.

Throws: SQLException
this is never thrown
 o createStatement
 public synchronized Statement createStatement() throws SQLException
This JDBC method creates an instance of MsqlStatement that is forward-only and read-only. Note that mSQL does not provide a way to interrupt executing statements, so it has to wait for any pending statements to finish before closing them.

Returns:
a new MsqlStatement instance
Throws: SQLException
an error occurred in creating the Statement instance, likely raised by the constructor
 o getAutoCommit
 public boolean getAutoCommit() throws SQLException
This method always returns true since mSQL is always in auto-commit mode.

Returns:
true--always
Throws: SQLException
never thrown
 o getCatalog
 public String getCatalog() throws SQLException
Provides the catalog name. For mSQL, this is the database to which you are connected.

Returns:
always null
Throws: SQLException
never thrown
 o getEncoding
 public String getEncoding()
Returns:
the encoding for the application
 o getMetaData
 public DatabaseMetaData getMetaData() throws SQLException
Provides meta-data for the database connection.

Returns:
the mSQL implementation of DatabaseMetaData
Throws: SQLException
this is never thrown
 o getTransactionIsolation
 public int getTransactionIsolation() throws SQLException
Returns:
the transaction isolation, always Connection.TRANSACTION_NONE
Throws: SQLException
this is never thrown
 o getUser
 public synchronized String getUser() throws SQLException
Returns:
the user name used for this Connection
Throws: SQLException
this is never thrown
 o getWarnings
 public SQLWarning getWarnings() throws SQLException
mSQL does not have warnings.

Returns:
always null
Throws: SQLException
this is never thrown
 o isClosed
 public synchronized boolean isClosed()
Returns:
true if this Connection has been closed
 o isReadOnly
 public boolean isReadOnly() throws SQLException
mSQL does not support read only connections, only read-only access rights.

Returns:
false--always
 o nativeSQL
 public String nativeSQL(String sql) throws SQLException
This gives the driver an opportunity to turn JDBC compliant SQL into mSQL specific SQL. My feeling is why bother.

Throws: SQLException
never thrown
 o prepareCall
 public CallableStatement prepareCall(String unused) throws SQLException
Callable statements are not supported by mSQL. This will therefore always throw an exception.

Parameters:
unused - the name of the stored procedure
Returns:
nothing, it always throws an exception
Throws: SQLException
this will always be thrown
 o prepareStatement
 public PreparedStatement prepareStatement(String sql) throws SQLException
Constructs a PreparedStatement matching the specified statement. Note that mSQL does not natively support prepared statements, so mSQL-JDBC prepared statement support is a bit faked. In other words, there is absolutely no performance benedit to using prepared statements with mSQL.

Parameters:
sql - the prepared statement
Returns:
a new PreparedStatement matching the specified SQL
Throws: SQLException
the Connection was unable to create a PreparedStatement for the specified SQL
 o rollback
 public void rollback() throws SQLException
This method always errors since you cannot rollback an mSQL transaction.

Throws: SQLException
this will always get thrown by this method
 o setAutoCommit
 public void setAutoCommit(boolean b) throws SQLException
This method will thrown an exception if you try to turn auto-commit off since JDBC does not support transactional logic.

Parameters:
b - should always be true
Throws: SQLException
thrown if the param is false
 o setCatalog
 public synchronized void setCatalog(String db) throws SQLException
Selects the database to be used by this connection.

Parameters:
db - the name of the mSQL database
Throws: SQLException
failed to set the new database
 o setReadOnly
 public void setReadOnly(boolean b) throws SQLException
mSQL does not support read-only mode.

Parameters:
b - should only ever be false
Throws: SQLException
this is thrown if an attempt is made to put the driver in read-only mode
 o setTransactionIsolation
 public void setTransactionIsolation(int unused) throws SQLException
This is not supported by mSQL, thus this is a NO-OP. The transaction isolation level is always set to Connection.TRANSACTION_NONE.

Parameters:
unused - the transaction isolation level
Throws: SQLException
this is never thrown
See Also:
TRANSACTION_NONE

All Packages  Class Hierarchy  This Package  Previous  Next  Index