com.sas.rio
Class MVAConnection

java.lang.Object
  |
  +--com.sas.rio.MVAConnection

public class MVAConnection
extends java.lang.Object
implements java.sql.Connection

A Connection represents a session with a specific database. Within the context of a Connection, SQL statements are executed and results are returned.

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 getMetaData 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.

See Also:
DriverManager.getConnection(java.lang.String), Statement, ResultSet, DatabaseMetaData

Field Summary
static int XHRSQPRECS
           
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
MVAConnection(com.sas.iom.SAS.IDataService sasDataService, java.util.Properties info)
          Constructs an MVAConnection object.
MVAConnection(java.lang.String url, java.util.Properties info)
          Constructs an MVAConnection object.
 
Method Summary
 void clearWarnings()
          Clears the warnings.
 void close()
          In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released; the close method provides this immediate release.
 void commit()
          Closes all the open Statement and PreparedStatement objects that are associated with this object.
 java.sql.Statement createStatement()
          Creates a Statement object.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
          JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden.
 boolean getAutoCommit()
          SAS software does not support transactions.
 java.lang.String getCatalog()
          Gets the Connection's current catalog name.
 java.sql.DatabaseMetaData getMetaData()
          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.
 int getTransactionIsolation()
          SAS software does not support transactions.
 java.util.Map getTypeMap()
          JDBC 2.0   * Gets the type-map object associated with this connection.
 java.sql.SQLWarning getWarnings()
          Gets the warning reported by calls on this Connection.
 boolean isClosed()
          Tests to see if a Connection is closed.
 boolean isReadOnly()
          SAS software does not support read-only connections.
 java.lang.String nativeSQL(java.lang.String sql)
          Returns the input string.
 java.sql.CallableStatement prepareCall(java.lang.String sql)
          Creates a CallableStatement object.
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
          JDBC 2.0 Same as prepareCall() above, but allows the default result set type and result set concurrency type to be overridden.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
          Creates a PreparedStatement object.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
          JDBC 2.0 Same as prepareStatement() above, but allows the default result set type and result set concurrency type to be overridden.
 void rollback()
          SAS software does not support transactions.
 void setAutoCommit(boolean autoCommit)
          Sets the auto-commit state.
 void setCatalog(java.lang.String catalog)
          A sub-space of this Connection's database may be selected by setting a catalog name.
 void setReadOnly(boolean readOnly)
          SAS software does not support read-only connections.
 void setTransactionIsolation(int level)
          SAS software does not support transactions.
 void setTypeMap(java.util.Map map)
          JDBC 2.0  * Install a type-map object as the default type-map for this connection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XHRSQPRECS

public static final int XHRSQPRECS
Constructor Detail

MVAConnection

public MVAConnection(java.lang.String url,
                     java.util.Properties info)
              throws java.sql.SQLException
Constructs an MVAConnection object.
Parameters:
url - initial input url containing host and port information.
info - java.util.Properties object which contains:

userName
MVA server access user name

password
MVA server access password

librefs
a semi-colon delimited list of 'name filepath'.

encryptionPolicy
whether or not JavaBridge should attempt to negotiate with the server over which encryption algorithm to use and what to do if the negotiations fail. Possible values:
none
do not use encryption. This is the default.
optional
attempt to use encryption but, if algorithm negotiation fails, continue with an unencrypted session
required
attempt to use encryption but, if algorithm negotiation fails, fail the connection

encryptionContent
specifies which messages should be encrypted if encryption is used. Possible values:
all
encrypt all messages. This is the default.
authentication
encrypt only messages that contain user name and password information.

encryptionAlgorithms
the list of algorithms you are willing to use in order of preference. Values in the list should be separated by commas and chosen from sasproprietary, rc2, rc4, des, or tripledes. If no value is specified, then one of the server's favorite algorithms will be used.
ldapDbmd
a "true" or "false" parameter to indicate if LDAP is to be accessed for DBMD. (optional. Required only for LDAP DBMD access.) Defaulted to "false" if this parameter is not specified.
ldapProviderUrl
Url to connect to LDAP server. (optional. Required only for LDAP DBMD access.)
authentication
LDAP authentication ("simple" or "none"). (optional. Required only for LDAP DBMD access.)
baseDN
a base Distinguished Name for LDAP access. (optional. Required only for LDAP DBMD access.)
ldapUserName
Distinguished Name of a user to use to connect to LDAP. (optional. Required only for LDAP DBMD access.)
ldapPassword
Password that corresponds with ldapUserName. (optional. Required only for LDAP DBMD access.)

Note that the server's encryption policy is, by default, optional so no special action is needed to prepare an IOM BRIDGE server to use encryption. However, it is possible to set up the server so that encryption is required. Consult IOM BRIDGE server documentation for details.

Throws:
java.sql.SQLException - This exception is thrown if a ShareNetException is detected.

MVAConnection

public MVAConnection(com.sas.iom.SAS.IDataService sasDataService,
                     java.util.Properties info)
              throws java.sql.SQLException
Constructs an MVAConnection object.
Parameters:
sasDataService - IDataService object.
info - java.util.Properties object which contains:
userName
MVA server access user name
password
MVA server access password
librefs
a semi-colon delimited list of 'name filepath'.
ldapDbmd
a "true" or "false" parameter to indicate if LDAP is to be accessed for DBMD. (optional. Required only for LDAP DBMD access.) Defaulted to "false" if this parameter is not specified.
ldapProviderUrl
Url to connect to LDAP server. (optional. Required only for LDAP DBMD access.)
authentication
LDAP authentication ("simple" or "none"). (optional. Required only for LDAP DBMD access.)
baseDN
a base Distinguished Name for LDAP access. (optional. Required only for LDAP DBMD access.)
ldapUserName
Distinguished Name of a user to use to connect to LDAP. (optional. Required only for LDAP DBMD access.)
ldapPassword
Password that corresponds with ldapUserName. (optional. Required only for LDAP DBMD access.)
Throws:
java.sql.SQLException - This exception is thrown if a ShareNetException is detected.
Method Detail

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
Creates a Statement object. SQL statements without parameters are normally executed using Statement objects. If the same SQL statement is executed many times, it is more efficient to use a PreparedStatement JDBC 2.0 Result sets created using the returned Statement will have forward-only type, and read-only concurrency, by default.
Specified by:
createStatement in interface java.sql.Connection
Returns:
a new Statement object
Throws:
java.sql.SQLException - This exception is thrown if an MVAStatement object cannot be created.

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
Creates a PreparedStatement object. A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times. JDBC 2.0 Result sets created using the returned PreparedStatement will have forward-only type, and read-only concurrency, by default.
Specified by:
prepareStatement in interface java.sql.Connection
Parameters:
sql - A SQL statement that may contain one or more '?' IN parameter placeholders.
Returns:
A new PreparedStatement object containing the pre-compiled statement.
Throws:
java.sql.SQLException - This exception is thrown if a PreparedStatement object cannot be created.

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException
Creates a CallableStatement object. JDBC 2.0 Result sets created using the returned CallableStatement will have forward-only type, and read-only concurrency, by default.
Specified by:
prepareCall in interface java.sql.Connection
Parameters:
sql - A SQL statement that may contain one or more '?' parameter placeholders. Typically this statement is a JDBC function call escape string.
Returns:
A new CallableStatement object containing the pre-compiled SQL statement
Throws:
java.sql.SQLException - This exception is required by the interface but it is never thrown.

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
Returns the input string. The SQL is not optimized.
Specified by:
nativeSQL in interface java.sql.Connection
Parameters:
sql - An input SQL string for optimization.
Returns:
An input string.
Throws:
java.sql.SQLException - This exception is required by the interface, but it is never thrown.

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws java.sql.SQLException
Sets the auto-commit state.
Specified by:
setAutoCommit in interface java.sql.Connection
Parameters:
autoCommit - This value must be True. SAS software does not support transactions.
Throws:
java.sql.SQLException - This exception is thrown if the value for autoCommit is False.

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException
SAS software does not support transactions. All statements are committed individually. The current auto-commit state is always True.
Specified by:
getAutoCommit in interface java.sql.Connection
Returns:
True.
Throws:
java.sql.SQLException - This exception is required by the interface, but it is never thrown.

commit

public void commit()
            throws java.sql.SQLException
Closes all the open Statement and PreparedStatement objects that are associated with this object.
Specified by:
commit in interface java.sql.Connection
Throws:
java.sql.SQLException - This exception is thrown if an exception occurred while outstanding statements were being closed.

rollback

public void rollback()
              throws java.sql.SQLException
SAS software does not support transactions. This method is not supported.
Specified by:
rollback in interface java.sql.Connection
Throws:
java.sql.SQLException - This exception is always thrown.

close

public void close()
           throws java.sql.SQLException
In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released; the close method provides this immediate release.

Note: A Connection is automatically closed when it is garbage collected. Certain fatal errors also result in a closed Connection.

Specified by:
close in interface java.sql.Connection
Throws:
java.sql.SQLException - This exception is thrown if an error condition is detected.

isClosed

public boolean isClosed()
                 throws java.sql.SQLException
Tests to see if a Connection is closed.
Specified by:
isClosed in interface java.sql.Connection
Returns:
true if the connection is closed; false if it's still open
Throws:
java.sql.SQLException - This exception is required by the interface but it is never thrown.

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
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 made available through a DatabaseMetaData object.
Specified by:
getMetaData in interface java.sql.Connection
Returns:
a DatabaseMetaData object for this Connection
Throws:
java.sql.SQLException - This exception is thrown if an DatabaseMetaData object cannot be created.

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws java.sql.SQLException
SAS software does not support read-only connections. The input value is ignored.
Specified by:
setReadOnly in interface java.sql.Connection
Parameters:
readOnly - This parameter is ignored.
Throws:
java.sql.SQLException - This exception is required by the interface, but it is never thrown.

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException
SAS software does not support read-only connections. The readOnly value is always False.
Specified by:
isReadOnly in interface java.sql.Connection
Returns:
False.
Throws:
java.sql.SQLException - This exception is required by the interface, but it is never thrown.

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException
A sub-space of this Connection's database may be selected by setting a catalog name. If the driver does not support catalogs it will silently ignore this request. NOTE: SAS software does not support catalogs and so the catalog string will be silently ignored.
Specified by:
setCatalog in interface java.sql.Connection
Throws:
java.sql.SQLException - This exception is required by the interface but it is never thrown.

getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
Gets the Connection's current catalog name.
Specified by:
getCatalog in interface java.sql.Connection
Returns:
NULL. SAS software does not support catalogs.
Throws:
java.sql.SQLException - if a database-access error occurs.

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws java.sql.SQLException
SAS software does not support transactions. The only valid input value is java.sql.Connection.TRANSACTION_NONE.
Specified by:
setTransactionIsolation in interface java.sql.Connection
Parameters:
level - The transaction level.
Throws:
java.sql.SQLException - This exception is thrown if the value of level is not valid.

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException
SAS software does not support transactions.
Specified by:
getTransactionIsolation in interface java.sql.Connection
Returns:
java.sql.Connection.TRANSACTION_NONE.
Throws:
java.sql.SQLException - This exception is required by the interface, but it is never thrown.

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
Gets the warning reported by calls on this Connection.

Note: Subsequent warnings will be chained to this SQLWarning.

Specified by:
getWarnings in interface java.sql.Connection
Returns:
The SQLWarning.
Throws:
java.sql.SQLException - This exception is required by the interface but it is never thrown.

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
Clears the warnings.
Specified by:
clearWarnings in interface java.sql.Connection
Throws:
java.sql.SQLException - This exception is required by the interface but it is never thrown.

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency)
                                   throws java.sql.SQLException
JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden. If an invalid type or concurrency is passed, the values are defaulted to TYPE_FORWARD_ONLY and CONCUR_READ_ONLY.
Specified by:
createStatement in interface java.sql.Connection
Parameters:
resultSetType - a result set type, see ResultSet.TYPE_XXX
resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX
Returns:
a new Statement object
Throws:
java.sql.SQLException - This exception is thrown if a Statement object cannot be created.

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency)
                                            throws java.sql.SQLException
JDBC 2.0 Same as prepareStatement() above, but allows the default result set type and result set concurrency type to be overridden. If an invalid type or concurrency is passed, the values are defaulted to TYPE_FORWARD_ONLY and CONCUR_READ_ONLY.
Specified by:
prepareStatement in interface java.sql.Connection
Parameters:
resultSetType - a result set type, see ResultSet.TYPE_XXX
resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX
Returns:
a new PreparedStatement object containing the pre-compiled SQL statement
Throws:
java.sql.SQLException - This exception is thrown if a PreparedStatement object cannot be created.

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency)
                                       throws java.sql.SQLException
JDBC 2.0 Same as prepareCall() above, but allows the default result set type and result set concurrency type to be overridden. If an invalid type or concurrency is passed, the values are defaulted to TYPE_FORWARD_ONLY and CONCUR_READ_ONLY.
Specified by:
prepareCall in interface java.sql.Connection
Parameters:
resultSetType - a result set type, see ResultSet.TYPE_XXX
resultSetConcurrency - a concurrency type, see ResultSet.CONCUR_XXX
Returns:
a new CallableStatement object containing the pre-compiled SQL statement
Throws:
java.sql.SQLException - This exception is thrown if a CallableStatement object cannot be created.

getTypeMap

public java.util.Map getTypeMap()
                         throws java.sql.SQLException
JDBC 2.0   * Gets the type-map object associated with this connection.   * By default, the map returned is empty. Method not supported.
Specified by:
getTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException - This exception is always thrown as SAS software does not support user defined types.  

setTypeMap

public void setTypeMap(java.util.Map map)
                throws java.sql.SQLException
JDBC 2.0  * Install a type-map object as the default type-map for this connection. Method not supported.
Specified by:
setTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException - This exception is always thrown as SAS software does not support user defined types.