Class Hierarchy All Classes All Fields and Methods

 

Class com.ibm.db.beans.DBStatement

java.lang.Object
        com.ibm.db.beans.DBStatement

public abstract class DBStatement
implements Serializable
extends Object

This abstract class is the parent for several other classes that expose JDBC 2.0 RowSet functionality. The JDBC RowSet "wraps" a connection, a statement, and a result set as a bean, and provides properties, methods, and events for using them.

Classes that extend this one include DBSelect, for executing a query and using its result set; DBProcedureCall, for calling a stored procedure and using any parameters or result sets it returns; and DBModify for executing an SQL statement that does not return a result set.

Field Index
Field Description
LEVEL_CONNECTION JDBC resource level representing java.sql.Connection object
LEVEL_RESULTSET JDBC resource level representing java.sql.ResultSet object
LEVEL_STATEMENT JDBC resource level representing java.sql.Statement object
TRANSACTION_DEFAULT Use default transaction isolation level for database.

Constructor Index
Constructor Description
DBStatement()  

Method Index
Method Description
void addDBAfterListener(DBAfterListener) Adds a listener to the DBAfter event set.
void addDBBeforeListener(DBBeforeListener) Adds a listener to the DBBefore event set.
void addPropertyChangeListener(PropertyChangeListener) Adds a listener to the PropertyChange event set.
void cancelAction() Cancels execution of the database action which is currently being performed via this bean.
void clearParameters() Clears the values of all statement parameters.
void close() Releases the underlying database and JDBC resources immediately instead of waiting for this to happen when the object is finalized.
void close(int) Releases the underlying database and JDBC resources immediately instead of waiting for this to happen when the object is finalized.
void commit() Commits changes to the database.
void execute() Executes the SQL statement, connecting to the database if not already connected.
int findParameter(String) Maps the given parameter name to its position.
boolean getAutoCommit() Gets the value of the autoCommit property.
String getCommand() Gets the SQL statement serving as the rowset's command property.
Connection getConnection() Gets the java.sql.Connection object used by this DBStatement.
DBConnectionSpec getConnectionSpec() Gets the DBConnectionSpec object used by this DBStatement.
String getDataSourceName() Gets the JNDI name of the javax.sql.DataSource to use when opening a database connection.
String getDriverName() Gets the class name of the JDBC driver that will automatically be loaded and registered for you before using the DriverManager to open a database connection.
String getInitialContextFactory() Gets the class name of the InitialContextFactory that will be used to locate a javax.sql.DataSource.
String getJspNullToken() Gets the String that will be used by default in JSPs that use this bean to represent a null value.
PrintWriter getLogWriter() Gets the PrintWriter being used to log any error or trace information written by this bean.
Object getParameter(int) Returns the value of the parameter at the specified position.
Object getParameter(String) Returns the value of the parameter with the specified name.
String getParameterAsString(int) Returns the value of the parameter at the specified position as a String.
String getParameterAsString(String) Returns the value of the parameter with the specified name as a String.
int getParameterCount() Returns the number of parameters in the SQL statement.
DBParameterMetaData getParameterMetaData() Retrieves the DBParameterMetaData object describing any statement parameters.
String getParameterName(int) Returns the name of the parameter at position.
String getPassword() Returns a String of asterisks (*) the length of the password used to create a database connection.
String getProviderUrl() Gets the URL of the machine where the naming service should look for a javax.sql.DataSource.
int getQueryTimeout() Gets the number of seconds to wait for a statement to execute.
boolean getTrace() Gets the tracing option of this bean.
int getTransactionIsolation() Gets the transaction isolation level.
String getUrl() Gets the url of the database to connect to using the DriverManager.
String getUsername() Gets the user name used to create a database connection.
boolean isExecuted() Returns true if execute has been invoked.
boolean isOpen() Returns true if the underlying JDBC objects are open, otherwise returns false.
boolean isOpen(int) Returns true if the underlying JDBC resource at the specified level is open, otherwise returns false.
boolean isOptimizeConvertToString() Indicates whether optimization for String conversion is on or off.
boolean isOptimizeForJsp() Indicates whether optimization for use in a Java Server Page (JSP) is on or off.
boolean isOptimizeForNoListeners() Indicates whether optimization for no event listeners is on or off.
void reExecute() Re-executes the statement.
void removeDBAfterListener(DBAfterListener) Removes a listener to the DBAfter event set.
void removeDBBeforeListener(DBBeforeListener) Removes a listener to the DBBefore event set.
void removePropertyChangeListener(PropertyChangeListener) Removes a listener to the PropertyChange event set.
void rollback() Rollback changes in the database.
void setAutoCommit(boolean) Sets the value of the autoCommit property.
void setCommand(String) Sets the SQL statement serving as the rowset's command property.
void setConnection(Connection) Sets the java.sql.Connection object used by this DBStatement.
void setConnectionSpec(DBConnectionSpec) Sets the DBConnectionSpec object used by this DBStatement.
void setDataSourceName(String) Specifies the name of a javax.sql.DataSource to use when opening a database connection, and clears any value previously set for the url property.
void setDriverName(String) Specifies the class name of a JDBC driver that will automatically be loaded and registered for you before using the DriverManager to open a database connection.
void setInitialContextFactory(String) Specifies the class name of the InitialContextFactory that will be used to locate a javax.sql.DataSource.
void setJspNullToken(String) Sets the String that will be used by default in JSPs that use this bean to represent a null value.
void setLogWriter(PrintWriter) Provides the PrintWriter that will be used to log any error or trace information written by this bean.
void setOptimizeConvertToString(boolean) Turns optimization for String conversion on or off.
void setOptimizeForJsp(boolean) Turns optimization for use in a Java Server Page (JSP) on or off.
void setOptimizeForNoListeners(boolean) Turns optimization for no event listeners on or off.
void setParameter(int, Object) Sets the parameter at the specified index to the specified value.
void setParameter(String, Object) Sets the parameter with the specified name to the specified value.
void setParameterFromString(int, String) Sets the parameter at the specified index to the specified value.
void setParameterFromString(String, String) Sets the parameter with the specified name to the specified value.
void setPassword(String) Sets the password used to create a database connection.
void setProviderUrl(String) Specifies the URL of the machine where the naming service should look for a javax.sql.DataSource.
void setQueryTimeout(int) Sets the number of seconds to wait for a statement to execute.
void setTrace(boolean) Sets the tracing option of this bean on or off.
void setTransactionIsolation(int) Sets the transaction isolation level.
void setUrl(String) Specifies the url of the database to connect to using the DriverManager, and clears any value previously set for the dataSourceName property.
void setUsername(String) Sets the user name used to create a database connection.
void shareConnectionWith(DBStatement) Makes this DBStatement object share the same java.sql.Connection object as another DBStatement object.

 

Fields

 

LEVEL_CONNECTION

public static final int LEVEL_CONNECTION

JDBC resource level representing java.sql.Connection object

 

LEVEL_RESULTSET

public static final int LEVEL_RESULTSET

JDBC resource level representing java.sql.ResultSet object

 

LEVEL_STATEMENT

public static final int LEVEL_STATEMENT

JDBC resource level representing java.sql.Statement object

 

TRANSACTION_DEFAULT

public static final int TRANSACTION_DEFAULT

Use default transaction isolation level for database.

 

Constructors

 

DBStatement

public DBStatement() 

 

Methods

 

addDBAfterListener

public abstract void addDBAfterListener(DBAfterListener listener) 

Adds a listener to the DBAfter event set. DBAfter events occur after significant actions have been completed via the DBStatement.

 

addDBBeforeListener

public abstract void addDBBeforeListener(DBBeforeListener listener) 

Adds a listener to the DBBefore event set. DBBefore events occur before significant actions have been completed via the DBStatement.

 

addPropertyChangeListener

public abstract void addPropertyChangeListener(PropertyChangeListener listener) 

Adds a listener to the PropertyChange event set.

 

cancelAction

public void cancelAction() throws DBException, SQLException

Cancels execution of the database action which is currently being performed via this bean. In order to use this method, it must be invoked from a thread different from the one in which the database action is occurring.

The database action is either execution of the SQL statement in the command property, or for some subclasses of this one, execution of a secondary related SQL statement, such as one to update, delete, or insert a row in the result set.

 

clearParameters

public void clearParameters() throws SQLException

Clears the values of all statement parameters.

After using this method, set a value for each input parameter before executing the statement.

In general, parameter values remain in force for repeated use of a RowSet. Setting a parameter value automatically clears its previous value. However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling clearParameters.

 

close

public abstract void close() throws DBException, SQLException

Releases the underlying database and JDBC resources immediately instead of waiting for this to happen when the object is finalized.

If autoCommit is false, explicitly do a commit or rollback before using the close method.

 

close

public abstract void close(int resourceLevel) throws DBException, SQLException

Releases the underlying database and JDBC resources immediately instead of waiting for this to happen when the object is finalized.

The value of the resourceLevel parameter determines which resources are released. If all resources, including the Connection, are released, and autoCommit is false, explicitly do a commit or rollback before using the close method.

 

commit

public void commit() throws DBException, SQLException

Commits changes to the database. All outstanding changes made to the database using the underlying java.sql.Connection are committed to the database and any database locks currently held by the connection are released. This method should only be used when auto commit has been turned off.

 

execute

public abstract void execute() throws DBException, SQLException

Executes the SQL statement, connecting to the database if not already connected.

 

findParameter

public int findParameter(String parameterName) throws DBException, SQLException

Maps the given parameter name to its position. The position of the first parameter is 1.

 

getAutoCommit

public boolean getAutoCommit() 

Gets the value of the autoCommit property. If you do not explicitly set this property, it defaults to true.

 

getCommand

public String getCommand() 

Gets the SQL statement serving as the rowset's command property. The command property contains a command string that can be executed. The default value is null.

 

getConnection

public Connection getConnection() 

Gets the java.sql.Connection object used by this DBStatement.

In general, it is expected that all operations involving the connection, the statement, or the result set will be performed via the DBStatement object. However, since not all methods of java.sql.Connection are made available via the DBStatement, you can use this method to get the Connection object and call any of its methods directly.

 

getConnectionSpec

public DBConnectionSpec getConnectionSpec() 

Gets the DBConnectionSpec object used by this DBStatement.

 

getDataSourceName

public String getDataSourceName() 

Gets the JNDI name of the javax.sql.DataSource to use when opening a database connection. Users should set either the url or dataSourceName property.

When a connection is established, either the dataSourceName property or the url property is used, whichever was specified most recently. If the dataSourceName is used, a connection is established via a javax.sql.DataSource object. If the url is used, a connection is established via the Driver Manager.

 

getDriverName

public String getDriverName() 

Gets the class name of the JDBC driver that will automatically be loaded and registered for you before using the DriverManager to open a database connection.

If this property is null or an empty string, no driver will be automaticaly loaded and registered. It may still be possible to connect via the DriverManager if an appropriate driver has been loaded and registered independently of this bean.

This property is only used if the url property is not null. If the url property is null, then this field is ignored and the connection is obtained using the DataSource specified in the dataSourceName property.

 

getInitialContextFactory

public String getInitialContextFactory() 

Gets the class name of the InitialContextFactory that will be used to locate a javax.sql.DataSource.

If this property is null, the default InitialContextFactory identified by the java.naming.factory.initial property in your java environment will be used.

This property is only used if the dataSourceName property is not null. If the dataSourceName property is null, then this field is ignored and the connection is obtained using the DriverManager.

 

getJspNullToken

public String getJspNullToken() 

Gets the String that will be used by default in JSPs that use this bean to represent a null value.

Although this method is public, it is expected only to be used by the code implementing the JSP SQL tags. The tags allow you to specify a null token at the level of a DBStatement which will be used when getting/setting any parameter or column whose tag does not override this null token with its own.

 

getLogWriter

public PrintWriter getLogWriter() 

Gets the PrintWriter being used to log any error or trace information written by this bean.

The default log writer logs to the Java console. When this property is set to null, no information is logged.

 

getParameter

public Object getParameter(int position) throws DBException, SQLException

Returns the value of the parameter at the specified position. If the parameter value is null, a null is returned. The position of the first parameter is 1.

 

getParameter

public Object getParameter(String parameterName) throws DBException, SQLException

Returns the value of the parameter with the specified name. If the parameter value is null, a null is returned.

 

getParameterAsString

public String getParameterAsString(int position) throws DBException, SQLException

Returns the value of the parameter at the specified position as a String. The value of the parameter is converted to a String before the value is returned. If the parameter value is null, a null is returned. The position of the first parameter is 1.

 

getParameterAsString

public String getParameterAsString(String parameterName) throws DBException, SQLException

Returns the value of the parameter with the specified name as a String. The value of the parameter is converted to a String before the value is returned. If the parameter value is null, a null is returned.

 

getParameterCount

public int getParameterCount() 

Returns the number of parameters in the SQL statement. The number returned is based on parameter definitions in the associated DBParameterMetaData, not on the string in the command property of this bean. However, the number of parameters in those two places must match when you execute.

 

getParameterMetaData

public DBParameterMetaData getParameterMetaData() throws SQLException

Retrieves the DBParameterMetaData object describing any statement parameters.

To provide meta data, use this method to get the empty meta data object created when this object was constructed, and fill it in.

 

getParameterName

public String getParameterName(int position) throws DBException, SQLException

Returns the name of the parameter at position. The position of the first parameter is 1.

 

getPassword

public String getPassword() 

Returns a String of asterisks (*) the length of the password used to create a database connection. The actual password is not returned so that the return value of this method can be displayed in a GUI without compromising security.

 

getProviderUrl

public String getProviderUrl() 

Gets the URL of the machine where the naming service should look for a javax.sql.DataSource.

If this property is null, the naming service will look on the local host.

This property is only used if the dataSourceName property is not null. If the dataSourceName property is null, then this field is ignored and the connection is obtained using the DriverManager.

 

getQueryTimeout

public int getQueryTimeout() throws SQLException

Gets the number of seconds to wait for a statement to execute. If the limit is exceeded, an exception is thrown.

 

getTrace

public boolean getTrace() 

Gets the tracing option of this bean. If you do not set this option explicitly, it is off by default.

When the tracing option is on, entries are written to the PrintWriter specified in the logWriter property.

 

getTransactionIsolation

public int getTransactionIsolation() 

Gets the transaction isolation level.

If you have not explicitly set this property, the method returns the constant DBStatement.TRANSACTION_DEFAULT. In this case, once you connect, transactionIsolation will be the default level for the database product you are using.

 

getUrl

public String getUrl() throws SQLException

Gets the url of the database to connect to using the DriverManager. The default value is null.

When a connection is established, either the dataSourceName property or the url property is used, whichever was specified most recently. If the dataSourceName is used, a connection is established via a javax.sql.DataSource object. If the url is used, a connection is established via the Driver Manager.

 

getUsername

public String getUsername() 

Gets the user name used to create a database connection.

 

isExecuted

public boolean isExecuted() 

Returns true if execute has been invoked.

 

isOpen

public abstract boolean isOpen() throws SQLException

Returns true if the underlying JDBC objects are open, otherwise returns false.

When isOpen returns true, all underlying JDBC objects are open, and the bean is fully functional.

When isOpen returns false, it may be because the statement has not been executed, the close method has been invoked, or the bean has been serialized and then de-serialized.

 

isOpen

public abstract boolean isOpen(int resourceLevel) throws DBException, SQLException

Returns true if the underlying JDBC resource at the specified level is open, otherwise returns false.

If the resourceLevel is LEVEL_CONNECTION, a return value of true indicates that the Connection is open. If the resourceLevel is LEVEL_STATEMENT, a return value of true indicates that the Statement, and therefore also the Connection are open. If the resourceLevel is LEVEL_RESULTSET, a return value of true indicates that the ResultSet, and therefore also the Statement, and Connection are open. (Note that not all subclasses of DBStatement have resources at the ResultSet level.)

 

isOptimizeConvertToString

public boolean isOptimizeConvertToString() 

Indicates whether optimization for String conversion is on or off. When this optimization is on, all values cached for the underlying RowSet and all parameter values are stored as Strings. When it is off, all values are stored in their default types.

 

isOptimizeForJsp

public boolean isOptimizeForJsp() 

Indicates whether optimization for use in a Java Server Page (JSP) is on or off. Turning on this optimization is equivalent to turning on both automatic String conversion (via optimizeConvertToString()) and suppression of event firing (via optimizeForNoListeners()). Turning off this optimization is equivalent to turning off both automatic String conversion and suppression of event firing.

 

isOptimizeForNoListeners

public boolean isOptimizeForNoListeners() 

Indicates whether optimization for no event listeners is on or off. When this optimization is on, no events are fired. When it is off, events are fired.

 

reExecute

public abstract void reExecute() throws DBException, SQLException

Re-executes the statement. The statement must currently be open. Any changes you have made to statement parameters will take effect when the statement is re-executed. If you have changed the statement itself, that change will not take effect. (To make the latter change take effect, use the execute method.

 

removeDBAfterListener

public abstract void removeDBAfterListener(DBAfterListener listener) 

Removes a listener to the DBAfter event set. DBAfter events occur after significant actions have been completed via the DBStatement.

 

removeDBBeforeListener

public abstract void removeDBBeforeListener(DBBeforeListener listener) 

Removes a listener to the DBBefore event set. DBBefore events occur before significant actions have been completed via the DBStatement.

 

removePropertyChangeListener

public synchronized void removePropertyChangeListener(PropertyChangeListener listener) 

Removes a listener to the PropertyChange event set.

 

rollback

public void rollback() throws DBException, SQLException

Rollback changes in the database. All changes made since the previous commit/rollback are rolled back and any database locks currently held by the connection are released. This method should only be used when auto commit has been turned off.

 

setAutoCommit

public void setAutoCommit(boolean autoCommit) throws DBException, SQLException

Sets the value of the autoCommit property.

You may set the property before or after connecting to the database. If you are already connected, the new setting is propagated immediately to the underlying java.sql.Connection object. If not, the new value will be used when you connect.

If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either the method commit or the method rollback.

The default value of this property is true.

 

setCommand

public void setCommand(String cmd) throws SQLException

Sets the SQL statement serving as the rowset's command property.

The command property contains a command string that can be executed. The default value is null.

 

setConnection

public synchronized void setConnection(Connection connection) throws DBException, SQLException

Sets the java.sql.Connection object used by this DBStatement.

In general, it is expected that the DBStatement will obtain a java.sql.Connection object at the time it is executed, based on the connection specification information you have provided. However, this method provides the flexibility to use a Connection you obtained outside the context of a DBStatement for whatever reason,

You should only use this method if there is a limitation of the connection semantics of the DBStatement which circumvent.

This method is not the recommended way of sharing a connection between two DBStatement objects in order, for example, to execute within the same transaction scope. For that purpose, use the shareConnectionWith method.

 

setConnectionSpec

public void setConnectionSpec(DBConnectionSpec aConnectionSpec) 

Sets the DBConnectionSpec object used by this DBStatement.

A user can set the connection properties directly on the statement (DBSelect, DBModify, or DBProcedureCalll) or use similar methods to set them on the DBConnectSpec and then set the statement's connectionSpec.

 

setDataSourceName

public void setDataSourceName(String name) throws SQLException

Specifies the name of a javax.sql.DataSource to use when opening a database connection, and clears any value previously set for the url property.

When a connection is established, either the dataSourceName property or the url property is used, whichever was specified most recently. If the dataSourceName is used, a connection is established via a javax.sql.DataSource object. If the url is used, a connection is established via the Driver Manager.

 

setDriverName

public void setDriverName(String driverName) throws SQLException

Specifies the class name of a JDBC driver that will automatically be loaded and registered for you before using the DriverManager to open a database connection. The name must be fully qualified with the package containing the driver. For example, the DB2 application JDBC driver is COM.ibm.db2.jdbc.appDB2Driver.

If this property is null or an empty string, no driver will be automaticaly loaded and registered. It may still be possible to connect via the DriverManager if an appropriate driver has been loaded and registered independently of this bean.

This property is only used if the url property is not null. If the url property is null, then this field is ignored and the connection is obtained using the DataSource specified in the dataSourceName property.

 

setInitialContextFactory

public void setInitialContextFactory(String initialContextFactory) throws SQLException

Specifies the class name of the InitialContextFactory that will be used to locate a javax.sql.DataSource. The name must be fully qualified with the package containing the class. For example, the InitialContextFactory for the WebSphere naming service is com.ibm.ejs.ns.jndi.CNInitialContextFactory.

If you set this property to null, the default InitialContextFactory identified by the property java.naming.factory.initial in your java environment will be used.

This property is only used if the dataSourceName property is not null. If the dataSourceName property is null, then this field is ignored and the connection is obtained using the DriverManager.

 

setJspNullToken

public void setJspNullToken(String token) 

Sets the String that will be used by default in JSPs that use this bean to represent a null value. The default value is the empty string ("").

Although this method is public, it is expected only to be used by the code implementing the JSP SQL tags. The tags allow you to specify a null token at the level of a DBStatement which will be used when getting/setting any parameter or column whose tag does not override this null token with its own.

 

setLogWriter

public synchronized void setLogWriter(PrintWriter out) throws SQLException

Provides the PrintWriter that will be used to log any error or trace information written by this bean.

If you do not explicitly use this method to provide a PrintWriter, information is logged by default to the Java console. If you wish to have no information logged, you can provide a null value here. If you wish to have log information for this bean and log information for your database written to the same place, provide the same PrintWriter for both the DriverManager.setLogWriter() method and this method.

 

setOptimizeConvertToString

public synchronized void setOptimizeConvertToString(boolean optimize) throws DBException

Turns optimization for String conversion on or off. When this optimization is on, all parameter and column values are stored as Strings unless you have explicitly mapped them to some other Java class. When it is off, all values are stored in their default types or the types to which you have mapped them.

You can only change the setting of this property before executing the SQL statement. If you never use this method to explicitly set the property, optimization is off by default.

 

setOptimizeForJsp

public synchronized void setOptimizeForJsp(boolean optimize) throws DBException

Turns optimization for use in a Java Server Page (JSP) on or off. Turning on this optimization is equivalent to turning on both automatic String conversion (via optimizeConvertToString()) and suppression of event firing (via optimizeForNoListeners()).

You can only change the setting of this property before executing the SQL statement. If you never use this method to explicitly set the property, optimization is off by default.

 

setOptimizeForNoListeners

public synchronized void setOptimizeForNoListeners(boolean optimize) throws DBException

Turns optimization for no event listeners on or off. When this optimization is on, no events are fired. When it is off, events are fired.

If you never use this method to explicitly set the property, optimization is off by default.

 

setParameter

public void setParameter(int parameterNumber,
                         Object aValue) throws DBException, SQLException

Sets the parameter at the specified index to the specified value. To set a parameter value to null, pass null as the value. The index of the first parameter is 1.

 

setParameter

public void setParameter(String parameterName,
                         Object aValue) throws DBException, SQLException

Sets the parameter with the specified name to the specified value. To set a parameter value to null, pass null as the value.

 

setParameterFromString

public void setParameterFromString(int parameterNumber,
                                   String stringValue) throws DBException, SQLException

Sets the parameter at the specified index to the specified value. The index of the first parameter is 1.

The stringValue is converted to the datatype associated with the parameter before the parameter is updated. To set a parameter value to null, pass null as the value. If the datatype is not String, you can also set a parameter value to null by passing a zero-length String as the value.

 

setParameterFromString

public void setParameterFromString(String parameterName,
                                   String stringValue) throws DBException, SQLException

Sets the parameter with the specified name to the specified value.

The stringValue is converted to the datatype associated with the parameter before the parameter is updated. To set a parameter value to null, pass null as the value. If the datatype is not String, you can also set a parameter value to null by passing a zero-length String as the value.

 

setPassword

public void setPassword(String password) throws SQLException

Sets the password used to create a database connection.

If the value passed in is a String of asterisks (*) the length of the current password, the value is not set. It is assumed in this case that a property editor has used getPassword() to get the password shape, and has used that same value to set the password, without real intent to change the password.

 

setProviderUrl

public void setProviderUrl(String providerUrl) throws SQLException

Specifies the URL of the machine where the naming service should look for a javax.sql.DataSource.

If you set this property to null, the naming service will look on the local host.

This property is only used if the dataSourceName property is not null. If the dataSourceName property is null, then this field is ignored and the connection is obtained using the DriverManager.

 

setQueryTimeout

public void setQueryTimeout(int seconds) throws DBException, SQLException

Sets the number of seconds to wait for a statement to execute. If the limit is exceeded, an exception is thrown.

 

setTrace

public synchronized void setTrace(boolean choice) throws SQLException

Sets the tracing option of this bean on or off. If you do not set this option explicitly, it is off by default.

When the tracing option is on, entries are written to the PrintWriter specified in the logWriter property.

 

setTransactionIsolation

public void setTransactionIsolation(int level) throws DBException, SQLException

Sets the transaction isolation level. You may set the property before or after connecting to the database. If you are already connected, the new setting is propagated immediately to the underlying java.sql.Connection object. If not, the new value will be used when you connect.

The default value for this property is the constant DBStatement.TRANSACTION_DEFAULT. When the property has this value, once you connect, transactionIsolation will be the default level for the database product you are using.

 

setUrl

public void setUrl(String url) throws SQLException

Specifies the url of the database to connect to using the DriverManager, and clears any value previously set for the dataSourceName property. The default value is null.

When a connection is established, either the dataSourceName property or the url property is used, whichever was specified most recently. If the dataSourceName is used, a connection is established via a javax.sql.DataSource object. If the url is used, a connection is established via the Driver Manager.

To connect using the Driver Manager, either insure that a driver that accepts the url has been loaded and registered, or use the setDriverName method to cause such a driver to be automatically loaded and registered for you.

 

setUsername

public void setUsername(String name) throws SQLException

Sets the user name used to create a database connection.

 

shareConnectionWith

public void shareConnectionWith(DBStatement statement) 

Makes this DBStatement object share the same java.sql.Connection object as another DBStatement object.

This allows multiple statements to occur within the same transaction if need be. *

If two DBStatement objects share the same java.sql.Connection, they also share the same DBConnectionSpec. However, two DBStatement objects which share the same DBConnectionSpec do not necessarily share the same java.sql.Connection.

Class Hierarchy All Classes All Fields and Methods