Inherits com.dbSpaces.jdb.Base.
Public Member Functions | |
void | begin () throws DatabaseException |
dtRtnStatus | close () throws DatabaseException |
void | commit () throws DatabaseException |
dtRtnStatus | connect (String dataSourceName) throws DatabaseException |
dtRtnStatus | connect (String dataSourceName, String userID, String password, String purposeName, String recipientID) throws DatabaseException |
dtRtnStatus | connect (String hostAddress, int portNumber, String namespace, String catalogName, String userID, String password, String purposeName, String recipientID) throws DatabaseException |
Statement | createStatement () throws DatabaseException |
Statement | createStatement (String name) throws DatabaseException |
String | getDataSourceName () |
String | getCatalogName () |
int | getConnectionOption (int option) throws DatabaseException |
DatabaseMetaData | getDatabaseMetaData () throws DatabaseException |
String | getClientInfo (String name) throws DatabaseException |
Properties | getClientInfo () throws DatabaseException |
int | getFetchSize () |
String | getHostAddress () |
Navigation | getNavigationObject () throws DatabaseException |
int | getPortNo () |
String | getPurpose () |
String | getRecipientID () |
String | getSchemaName () |
String | getUserID () |
String | getUserPassword () |
String | getServerName () throws DatabaseException |
String | getServiceName () |
Statement | getStatement (int statementHandle) throws DatabaseException |
Statement | getStatement (String statementName) throws DatabaseException |
dtRtnStatus | setAutoStartTransact (boolean enable) throws DatabaseException |
boolean | setFetchSize (int size) throws DatabaseException |
void | setPurposeName (String name) |
void | setRecepientID (String recipientID) |
void | setTimeout (int period) throws DatabaseException |
dtRtnStatus | setCatalog (String catalogName) throws DatabaseException |
dtRtnStatus | setClientInfo (Properties cliInfo) throws DatabaseException |
dtRtnStatus | setClientInfo (String name, String value) throws DatabaseException |
dtRtnStatus | setSchema (String schemaName) throws DatabaseException |
dtRtnStatus | setEnableAutoCommit (boolean enable) throws DatabaseException |
dtRtnStatus | setEnableDefaultSynonyms (boolean enable) throws DatabaseException |
dtRtnStatus | setEnableFlatDefinitions (boolean enable) throws DatabaseException |
dtRtnStatus | setEnableReadOnly (boolean enable) throws DatabaseException |
void | setProgramName (String name) |
dtRtnStatus | reconnect () throws DatabaseException |
dtRtnStatus | rollback () throws DatabaseException |
boolean | isAutoCommitEnabled () throws DatabaseException |
boolean | isClosed () |
boolean | isCompressionEnabled () |
boolean | isDefaultSynonymsEnabled () |
boolean | isNetworkTypesEnabled () |
boolean | isReadOnly () throws DatabaseException |
boolean | isTransactionInProgress () |
boolean | isValid () |
Static Public Attributes | |
static final int | TRANSACTION_NONE = 0 |
static final int | TRANSACTION_READ_UNCOMMITTED = 1 |
static final int | TRANSACTION_READ_COMMITTED = 2 |
static final int | TRANSACTION_REPEATABLE_READ = 4 |
static final int | TRANSACTION_SERIALIZABLE = 8 |
A Connection represents a session with a specific database.
Within the context of a Connection, SQL statements can be executed with potentially result sets being returned, or Navigational (NO-SQL) requests can be executed for retrieving, inserting, deleting and updating rows.
A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. This information is obtained with the getDatabaseMetaData method.
Note: By default the Connection automatically commits changes after executing each statement. If auto commit has been disabled, an explicit commit must be done or database changes will not be saved.
A DatabaseException will be thrown if a database error occurs and exceptions are enabled. If exceptions are not enabled the following error methods can be used to get information about the error;
void com.dbSpaces.jdb.Connection.begin | ( | ) | throws DatabaseException |
Start a new transaction.
DatabaseException | (if exceptions are enabled) when a database error occurs. |
dtRtnStatus com.dbSpaces.jdb.Connection.close | ( | ) | throws DatabaseException |
Close the connection to the server. Close will also close any open Statements, ResultSet and Navigation objects. If there are any active transactions they will be rolled back if they have not been already committed.
DatabaseException | (if exceptions are enabled) when a database error occurs. |
void com.dbSpaces.jdb.Connection.commit | ( | ) | throws DatabaseException |
Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection. This method should only be used when auto commit has been disabled.
DatabaseException | (if exceptions are enabled) when a database error occurs. |
dtRtnStatus com.dbSpaces.jdb.Connection.connect | ( | String | dataSourceName | ) | throws DatabaseException |
For more information on Data sources and Network Services see the dbSpaces Config program.
dataSourceName | Data source name. |
DatabaseException |
dtRtnStatus com.dbSpaces.jdb.Connection.connect | ( | String | dataSourceName, |
String | userID, | ||
String | password, | ||
String | purposeName, | ||
String | recipientID | ||
) | throws DatabaseException |
Make a connection to the database server using a Data source name.
The connection credentials are made up of; userID, password, Purpose name, and Recipient ID.
For more information on Data sources and Network Services see the dbSpaces Config program.
dataSourceName | Data source name. |
userID | User ID to use. |
password | User password to use. |
purposeName | Purpose name to use (if not provided defaults to 'ANY'). |
recipientID | Recipient ID to to (if not provided defaults to 'ANY'). |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
dtRtnStatus com.dbSpaces.jdb.Connection.connect | ( | String | hostAddress, |
int | portNumber, | ||
String | namespace, | ||
String | catalogName, | ||
String | userID, | ||
String | password, | ||
String | purposeName, | ||
String | recipientID | ||
) | throws DatabaseException |
Make a connection to the database server using the Host address and Port number.
The connection credentials are made up of; userID, password, Purpose name, and Recipient ID.
hostAddress | The host address for the database server. |
portNumber | The port number for the database server. |
namespace | The namespace to connect to. |
catalogName | Catalog name. |
userID | User ID to use. |
password | User password to use. |
purposeName | Purpose name to use (if not provided defaults to 'ANY'). |
recipientID | Recipient ID to to (if not provided defaults to 'ANY'). |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
Statement com.dbSpaces.jdb.Connection.createStatement | ( | ) | throws DatabaseException |
Creates an unamed Statement object for executing SQL statements.
DatabaseException | (if exceptions are enabled) when a database error occurs. |
Statement com.dbSpaces.jdb.Connection.createStatement | ( | String | name | ) | throws DatabaseException |
Creates a named Statement
object for executing SQL statements.
name | Unique name for the statement. |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
String com.dbSpaces.jdb.Connection.getCatalogName | ( | ) |
Get the current Catalog name for the connection.
Properties com.dbSpaces.jdb.Connection.getClientInfo | ( | ) | throws DatabaseException |
Returns a list containing the name and current value of each client info property. The value of a client info property may be null if the property has not been set and does not have a default value.
Properties
object that contains the name and current value of each of the client info properties supported by the driver. DatabaseException | if the database server returns an error when fetching the client info values from the database or this method is called on a closed connection |
String com.dbSpaces.jdb.Connection.getClientInfo | ( | String | name | ) | throws DatabaseException |
Returns the value of the client info property specified by name. This method may return null if the specified client info property has not been set, does not have a default value or is an invalid property.
Applications may use the DatabaseMetaData.getClientInfoProperties
method to determine the client info properties supported by the driver.
name | The name of the client info property to retrieve |
DatabaseException | if the database server returns an error when fetching the client info value from the database or this method is called on a closed connection |
int com.dbSpaces.jdb.Connection.getConnectionOption | ( | int | option | ) | throws DatabaseException |
Get the value of the connection option provided.
option | Connection option |
DatabaseException |
DatabaseMetaData com.dbSpaces.jdb.Connection.getDatabaseMetaData | ( | ) | throws DatabaseException |
Get the DatabaseMetaData object for the connection.
DatabaseException | (if exceptions are enabled) when a database error occurs. |
String com.dbSpaces.jdb.Connection.getDataSourceName | ( | ) |
Get the data source name used for the connection.
int com.dbSpaces.jdb.Connection.getFetchSize | ( | ) |
Get the fetch size for returning rows with the ResultSet object.
String com.dbSpaces.jdb.Connection.getHostAddress | ( | ) |
Get the host address that was used to connect to the server with.
Navigation com.dbSpaces.jdb.Connection.getNavigationObject | ( | ) | throws DatabaseException |
Get the Navigation object for the Connection. The Navigation object allows NO-SQL access to the tables in the database.
int com.dbSpaces.jdb.Connection.getPortNo | ( | ) |
Get the port number used to connect to the server with.
String com.dbSpaces.jdb.Connection.getPurpose | ( | ) |
Get the Purpose name for the connection.
String com.dbSpaces.jdb.Connection.getRecipientID | ( | ) |
Get the Recipient ID for the connection.
String com.dbSpaces.jdb.Connection.getSchemaName | ( | ) |
Get the current schema name for the connection.
String com.dbSpaces.jdb.Connection.getServerName | ( | ) | throws DatabaseException |
Get the local server name for the connection.
DatabaseException | (if exceptions are enabled) when a database error occurs. |
String com.dbSpaces.jdb.Connection.getServiceName | ( | ) |
Get the name of the Service used by the connection. Services are used to define the method of communicating with the server.
Statement com.dbSpaces.jdb.Connection.getStatement | ( | int | statementHandle | ) | throws DatabaseException |
Get an existing Statement object using the statement handle.
statementHandle | The statement handle to find. |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
Statement com.dbSpaces.jdb.Connection.getStatement | ( | String | statementName | ) | throws DatabaseException |
Get an existing Statement object using the statement name.
statementName | The statement name to find. |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
String com.dbSpaces.jdb.Connection.getUserID | ( | ) |
Get the User ID that was used to connect to the server.
String com.dbSpaces.jdb.Connection.getUserPassword | ( | ) |
Get the user Password that was used to connect to the server.
boolean com.dbSpaces.jdb.Connection.isAutoCommitEnabled | ( | ) | throws DatabaseException |
Check if auto-commit is enabled.
true
if auto-commit is enabled; false
if otherwise. boolean com.dbSpaces.jdb.Connection.isClosed | ( | ) |
Check if the connection to the server is closed.
true
if closed; false
if otherwise. boolean com.dbSpaces.jdb.Connection.isCompressionEnabled | ( | ) |
Check if compression is enabled? If compression is enabled then size of data packets sent to the server is reduced.
true
if compression is enabled; false
if otherwise. boolean com.dbSpaces.jdb.Connection.isDefaultSynonymsEnabled | ( | ) |
Check if default synonyms is enabled? If default synonyms are enabled then they will be used instead of column names.
true
if default synonyms are enabled; false
if otherwise. boolean com.dbSpaces.jdb.Connection.isNetworkTypesEnabled | ( | ) |
Check if network data types are enabled. The standard for sending data across the network is high-low endian. If your client is of the same byte order as the server network data types do not need to be enabled which helps with performance.
true
if network data types are enabled; false
if otherwise. boolean com.dbSpaces.jdb.Connection.isReadOnly | ( | ) | throws DatabaseException |
Check if the connection is read-only. If the connection has been set to read-only then any m_request other then a read will produce an error.
true
if read-only; false
if otherwise. boolean com.dbSpaces.jdb.Connection.isTransactionInProgress | ( | ) |
Is there an active transaction in progress?
true
if transaction is active; false
if otherwise. boolean com.dbSpaces.jdb.Connection.isValid | ( | ) |
Is the connection still valid?
true
if connection is valid; false
if otherwise. dtRtnStatus com.dbSpaces.jdb.Connection.reconnect | ( | ) | throws DatabaseException |
Reconnect if the connection has been closed.
DatabaseException | (if exceptions are enabled) when a database error occurs |
dtRtnStatus com.dbSpaces.jdb.Connection.rollback | ( | ) | throws DatabaseException |
Rolls back the work of an existing transaction.
DatabaseException | (if exceptions are enabled) when a database error occurs |
dtRtnStatus com.dbSpaces.jdb.Connection.setAutoStartTransact | ( | boolean | enable | ) | throws DatabaseException |
Set auto start a transaction state.
enable | true auto start is on, false auto start is off (default). |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
dtRtnStatus com.dbSpaces.jdb.Connection.setCatalog | ( | String | catalogName | ) | throws DatabaseException |
Set the active Catalog for the connection.
catalogName | The name of the catalog to use. |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
dtRtnStatus com.dbSpaces.jdb.Connection.setClientInfo | ( | Properties | cliInfo | ) | throws DatabaseException |
Sets the value of the connection's client info properties. The Properties
object contains the names and values of the client info properties to be set. The set of client info properties contained in the properties list replaces the current set of client info properties on the connection. If a property that is currently set on the connection is not present in the properties list, that property is cleared. Specifying an empty properties list will clear all of the properties on the connection.
clientInfo | Client info properties |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
dtRtnStatus com.dbSpaces.jdb.Connection.setClientInfo | ( | String | name, |
String | value | ||
) | throws DatabaseException |
Sets the value of the client info property specified by name to the value specified by value.
name | Name of the client info property. |
value | New property value, if null the current value is cleared. |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
dtRtnStatus com.dbSpaces.jdb.Connection.setEnableAutoCommit | ( | boolean | enable | ) | throws DatabaseException |
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/Navigation requests are grouped into transactions that are terminated by either commit() or rollback(). By default, new connections are in auto-commit mode.
The commit occurs when the statement completes or the next execute occurs, whichever comes first. In the case of statements returning a ResultSet, the statement completes when the last row of the ResultSet has been retrieved or the ResultSet has been closed. In advanced cases, a single statement may return multiple results as well as output parameter values. Here the commit occurs when all results and output param values have been retrieved.
If caching has been enabled then any outstanding Navigation requests are flushed to the database and then the commit occurs.
enable | true enables auto-commit; false disables auto-commit (default). |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
dtRtnStatus com.dbSpaces.jdb.Connection.setEnableDefaultSynonyms | ( | boolean | enable | ) | throws DatabaseException |
Set use default synonyms if they exist and not the table's column names.
enable | true , use default synonyms; false do not use default synonyms (default). |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
dtRtnStatus com.dbSpaces.jdb.Connection.setEnableFlatDefinitions | ( | boolean | enable | ) | throws DatabaseException |
Set use flat definitions for tables and views.
enable | true , use flat definitions; false do not use flat definitions (default). |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
dtRtnStatus com.dbSpaces.jdb.Connection.setEnableReadOnly | ( | boolean | enable | ) | throws DatabaseException |
You can put a connection in read-only mode as a hint to enable database optimizations.
Note: setEnableReadOnly cannot be called while in the middle of a transaction.
enable | true enables read-only mode; false disables read-only mode (default). |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
boolean com.dbSpaces.jdb.Connection.setFetchSize | ( | int | size | ) | throws DatabaseException |
Set the fetch size for the number of rows returned from a ResultSet or NavigationTable.
size | The new fetch size. |
true
if successful; false
if otherwise. DatabaseException | (if exceptions are enabled) when a database error occurs; |
void com.dbSpaces.jdb.Connection.setProgramName | ( | String | name | ) |
Set the program name to identify the connection by in the server.
name | The Program name. |
void com.dbSpaces.jdb.Connection.setPurposeName | ( | String | name | ) |
Set the Purpose name for the connection.
Setting the Purpose name should be set before a connection, reconnection or the set catalog call.
If the Hippocratic Security addon is not licensed or not enabled for the database, the Purpose name is ignored.
name | The Purpose name. |
void com.dbSpaces.jdb.Connection.setRecepientID | ( | String | recipientID | ) |
Set the Recipient ID for the connection.
Setting the Recipient ID should be set before a connection, reconnection or the set catalog call.
If the Hippocratic Security addon is not licensed or not enabled for the database, the Recipient ID is ignored.
recipientID | The Recipient ID. |
dtRtnStatus com.dbSpaces.jdb.Connection.setSchema | ( | String | schemaName | ) | throws DatabaseException |
Set the active schema for the connection.
schemaName | The name of the schema to use. |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
void com.dbSpaces.jdb.Connection.setTimeout | ( | int | period | ) | throws DatabaseException |
Set the time out period when connecting to the server.
period | The number of seconds before timing out. |
DatabaseException | (if exceptions are enabled) when a database error occurs. |
|
static |
Transactions are not supported.
|
static |
Dirty reads are prevented; non-repeatable reads and phantom reads can occur. This level only prohibits a transaction from reading a row with uncommitted changes in it.
|
static |
Dirty reads, non-repeatable reads and phantom reads can occur. This level allows a row changed by one transaction to be read by another transaction before any changes in that row have been committed (a "dirty read"). If any of the changes are rolled back, the second transaction will have retrieved an invalid row.
|
static |
Dirty reads and non-repeatable reads are prevented; phantom reads can occur. This level prohibits a transaction from reading a row with uncommitted changes in it, and it also prohibits the situation where one transaction reads a row, a second transaction alters the row, and the first transaction rereads the row, getting different values the second time (a "non-repeatable read").
|
static |
Dirty reads, non-repeatable reads and phantom reads are prevented. This level includes the prohibitions in TRANSACTION_REPEATABLE_READ and further prohibits the situation where one transaction reads all rows that satisfy a WHERE condition, a second transaction inserts a row that satisfies that WHERE condition, and the first transaction rereads for the same condition, retrieving the additional "phantom" row in the second read.