Package com.sas.rio

Class MVAConnection

java.lang.Object
com.sas.rio.MVAConnection
All Implemented Interfaces:
AutoCloseable, Connection, Wrapper

public class MVAConnection extends Object implements 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, java.util.Properties)
  • Statement
  • ResultSet
  • DatabaseMetaData
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected int
     

    Fields inherited from interface java.sql.Connection

    TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
  • Constructor Summary

    Constructors
    Constructor
    Description
    MVAConnection(IDataService sasDataService, Properties info)
    Constructs an MVAConnection object.
    MVAConnection(IWorkspace sasWorkspace, Properties info)
    Constructs an MVAConnection object.
    MVAConnection(RIOUtil x, Properties info)
     
    MVAConnection(String url, Properties info)
    Constructs an MVAConnection object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    abort(java.util.concurrent.Executor arg0)
     
    void
    void
    void
    Array
    createArrayOf(String typeName, Object[] elements)
    This method is not supported.
    Blob
    This method is not supported.
    Clob
    This method is not supported.
    NClob
    This method is not supported.
    SQLXML
    This method is not supported.
    Statement
    Statement
    createStatement(int resultSetType, int resultSetConcurrency)
    Statement
    createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
    The MVAConnection implementation of createStatement(int, int, int) throws a SQLFeatureNotSupportedException if the value provided for resultSetHoldability is not ResultSet.CLOSE_CURSORS_AT_COMMIT.
    Struct
    createStruct(String typeName, Object[] attributes)
    The MVAConnection implementation of createStruct(String, Object[]) always throws a SQLFeatureNotSupportedException.
    boolean
    The SAS IOM JDBC driver does not support transactions.
    String
    The MVAConnection implementation of getCatalog always returns .
    Properties
    The MVAConnection implementation of getClientInfo always returns an empty properties object.
    String
    getClientInfo(String name)
    The MVAConnection implementation of getClientInfo(String) always returns null.
    int
    String
     
    DatabaseMetaData
    int
     
    protected RIOUtil
     
    String
     
    int
    The MVAConnection implementation of getTransactionIsolation always returns Connection.TRANSACTION_NONE.
    Map<String,Class<?>>
    The MVAConnection implementation of getTypeMap() always throws a SQLFeatureNotSupportedException.
    SQLWarning
    boolean
    boolean
    The MVAConnection implementation of getReadOnly() always returns false.
    boolean
    isValid(int timeout)
    boolean
    isWrapperFor(Class<?> iface)
    String
    nativeSQL(String sql)
    CallableStatement
    prepareCall(String sql)
    CallableStatement
    prepareCall(String sql, int resultSetType, int resultSetConcurrency)
    CallableStatement
    prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
    Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.
    PreparedStatement
    prepareStatement(String sql)
    PreparedStatement
    prepareStatement(String sql, int autoGeneratedKeys)
    The MVAConnection implementation of prepareStatement(String, int) always throws SQLFeatureNotSupportedException.
    PreparedStatement
    prepareStatement(String sql, int[] columnIndexes)
    The MVAConnection implementation of prepareStatement(String, int[]) always throws SQLFeatureNotSupportedException.
    PreparedStatement
    prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
    PreparedStatement
    prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
    PreparedStatement
    prepareStatement(String sql, String[] columnNames)
    The MVAConnection implementation of prepareStatement(String, String[]) always throws SQLFeatureNotSupportedException.
    void
    releaseSavepoint(Savepoint savepoint)
    The MVAConnection implementation of releaseSavepoint always throws SQLFeatureNotSupportedException.
    void
    SAS software does not support transactions.
    void
    rollback(Savepoint savepoint)
    The MVAConnection implementation of rollback always throws SQLFeatureNotSupportedException.
    void
    setAutoCommit(boolean autoCommit)
    The SAS IOM JDBC driver does not support transactions.
    void
    setCatalog(String catalog)
    The MVAConnection implementation of setCatalog silently ignores the value provided for catalog.
    void
    setClientInfo(String name, String value)
    The MVAConnection implementation of setClientInfo(String, String) adds a warning to the Connection object for any property provided.
    void
    setClientInfo(Properties properties)
    The MVAConnection implementation of setClientInfo(Properties) adds a warning to the Connection object for all properties provided.
    void
    setHoldability(int holdability)
    The MVAConnection implementation of setHoldability(int) only supports ResultSet.CLOSE_CURSORS_AT_COMMIT for holdability.
    void
    setNetworkTimeout(java.util.concurrent.Executor arg0, int arg1)
     
    void
    setReadOnly(boolean readOnly)
    The MVAConnection implementation of setReadOnly(boolean) ignores the value of readOnly.
    Savepoint
    The MVAConnection implementation of setSavepoint() always throws SQLFeatureNotSupportedException.
    Savepoint
    setSavepoint(String name)
    The MVAConnection implementation of setSavepoint(String) always throws SQLFeatureNotSupportedException.
    void
    setSchema(String arg0)
     
    void
    SAS software does not support transactions.
    void
    setTypeMap(Map<String,Class<?>> map)
    The MVAConnection implementation of setTypeMap() always throws a SQLFeatureNotSupportedException.
    <T> T
    unwrap(Class<T> iface)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.sql.Connection

    beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
  • Field Details

    • resultSetType

      protected int resultSetType
    • resultSetConcurrency

      protected int resultSetConcurrency
  • Constructor Details

    • MVAConnection

      public MVAConnection(String url, Properties info) throws 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 semicolon 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, aes, des, or tripledes. If no value is specified, then one of the server's favorite algorithms will be used.

      applyFormats
      specifies whether or not column formats are applied when retrieving data. If the value is true, all data is returned as Strings. For any column, the format used is the one defined on the column in the data set. If "applyFormats" is set to false (the default case) no formatting is applied.

      segmentLength
      Specifies the segment length value, in bytes, for character annotations when initially added to a SAS result set. This property is not used with result sets that already have annotations. The server uses the segment length to define the buffer width of character extended attribute values. These values can span multiple segments. The default value of the segment length is 256 bytes.

      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:
      SQLException - This exception is thrown if a ShareNetException is detected.
    • MVAConnection

      public MVAConnection(IDataService sasDataService, Properties info) throws 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 semicolon delimited list of 'name filepath'.
      Throws:
      SQLException - This exception is thrown if a ShareNetException is detected.
    • MVAConnection

      public MVAConnection(IWorkspace sasWorkspace, Properties info) throws SQLException
      Constructs an MVAConnection object.
      Parameters:
      sasWorkspace - IWorkspace object.
      info - java.util.Properties object which contains:
      userName
      MVA server access user name
      password
      MVA server access password
      librefs
      a semicolon delimited list of 'name filepath'.
      Throws:
      SQLException - This exception is thrown if a ShareNetException is detected.
    • MVAConnection

      public MVAConnection(RIOUtil x, Properties info) throws SQLException
      Throws:
      SQLException
  • Method Details

    • getIdForLogger

      public String getIdForLogger()
    • createStatement

      public Statement createStatement() throws SQLException
      Specified by:
      createStatement in interface Connection
      Throws:
      SQLException
    • prepareStatement

      public PreparedStatement prepareStatement(String sql) throws SQLException
      Specified by:
      prepareStatement in interface Connection
      Throws:
      SQLException
    • prepareCall

      public CallableStatement prepareCall(String sql) throws SQLException
      Specified by:
      prepareCall in interface Connection
      Throws:
      SQLException
    • nativeSQL

      public String nativeSQL(String sql) throws SQLException
      Specified by:
      nativeSQL in interface Connection
      Throws:
      SQLException
    • setAutoCommit

      public void setAutoCommit(boolean autoCommit) throws SQLException
      The SAS IOM JDBC driver does not support transactions. Calling setAutoCommit(boolean) with a value of false will cause an exception.

      Specified by:
      setAutoCommit in interface Connection
      Throws:
      SQLException
    • getAutoCommit

      public boolean getAutoCommit() throws SQLException
      The SAS IOM JDBC driver does not support transactions. getAutoCommit() will always return true.

      Specified by:
      getAutoCommit in interface Connection
      Throws:
      SQLException
    • commit

      public void commit() throws SQLException
      Specified by:
      commit in interface Connection
      Throws:
      SQLException
    • rollback

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

      public void close() throws SQLException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Connection
      Throws:
      SQLException
    • isClosed

      public boolean isClosed() throws SQLException
      Specified by:
      isClosed in interface Connection
      Throws:
      SQLException
    • getMetaData

      public DatabaseMetaData getMetaData() throws SQLException
      Specified by:
      getMetaData in interface Connection
      Throws:
      SQLException
    • setReadOnly

      public void setReadOnly(boolean readOnly) throws SQLException
      The MVAConnection implementation of setReadOnly(boolean) ignores the value of readOnly. The IOM JDBC Driver does not support read only connections.

      Specified by:
      setReadOnly in interface Connection
      Throws:
      SQLException
    • isReadOnly

      public boolean isReadOnly() throws SQLException
      The MVAConnection implementation of getReadOnly() always returns false. The IOM JDBC Driver does not support read only connections.

      Specified by:
      isReadOnly in interface Connection
      Throws:
      SQLException
    • setCatalog

      public void setCatalog(String catalog) throws SQLException
      The MVAConnection implementation of setCatalog silently ignores the value provided for catalog. The IOM JDBC Driver does not support catalogs.

      Specified by:
      setCatalog in interface Connection
      Throws:
      SQLException
    • getCatalog

      public String getCatalog() throws SQLException
      The MVAConnection implementation of getCatalog always returns . The IOM JDBC Driver does not support catalogs.
      Specified by:
      getCatalog in interface Connection
      Throws:
      SQLException
    • setTransactionIsolation

      public void setTransactionIsolation(int level) throws SQLException
      SAS software does not support transactions. The only valid input value is java.sql.Connection.TRANSACTION_NONE.

      Specified by:
      setTransactionIsolation in interface Connection
      Throws:
      SQLException
    • getTransactionIsolation

      public int getTransactionIsolation() throws SQLException
      The MVAConnection implementation of getTransactionIsolation always returns Connection.TRANSACTION_NONE. The SAS IOM JDBC driver does not support transactions.

      Specified by:
      getTransactionIsolation in interface Connection
      Throws:
      SQLException
    • getWarnings

      public SQLWarning getWarnings() throws SQLException
      Specified by:
      getWarnings in interface Connection
      Throws:
      SQLException
    • clearWarnings

      public void clearWarnings() throws SQLException
      Specified by:
      clearWarnings in interface Connection
      Throws:
      SQLException
    • createStatement

      public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
      Specified by:
      createStatement in interface Connection
      Throws:
      SQLException
    • prepareStatement

      public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
      Specified by:
      prepareStatement in interface Connection
      Throws:
      SQLException
    • prepareCall

      public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
      Specified by:
      prepareCall in interface Connection
      Throws:
      SQLException
    • getTypeMap

      public Map<String,Class<?>> getTypeMap() throws SQLException
      The MVAConnection implementation of getTypeMap() always throws a SQLFeatureNotSupportedException. Base SAS does not support SQL structured types.

      Specified by:
      getTypeMap in interface Connection
      Throws:
      SQLException
    • setTypeMap

      public void setTypeMap(Map<String,Class<?>> map) throws SQLException
      The MVAConnection implementation of setTypeMap() always throws a SQLFeatureNotSupportedException. Base SAS does not support SQL structured types.

      Specified by:
      setTypeMap in interface Connection
      Throws:
      SQLException
    • getRioUtil

      protected RIOUtil getRioUtil()
    • createStatement

      public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
      The MVAConnection implementation of createStatement(int, int, int) throws a SQLFeatureNotSupportedException if the value provided for resultSetHoldability is not ResultSet.CLOSE_CURSORS_AT_COMMIT.

      Specified by:
      createStatement in interface Connection
      Throws:
      SQLException
    • getHoldability

      public int getHoldability() throws SQLException
      Specified by:
      getHoldability in interface Connection
      Throws:
      SQLException
    • prepareCall

      public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
      Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency. Empty method implementation for JDK1.4 compliance.
      Specified by:
      prepareCall in interface Connection
      Throws:
      SQLException - This exception is always thrown to indicate the method is not implemented.
    • prepareStatement

      public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
      The MVAConnection implementation of prepareStatement(String, int) always throws SQLFeatureNotSupportedException. The IOM JDBC driver does not support auto-generated keys.

      Specified by:
      prepareStatement in interface Connection
      Throws:
      SQLException
    • prepareStatement

      public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
      The MVAConnection implementation of prepareStatement(String, int[]) always throws SQLFeatureNotSupportedException. The IOM JDBC driver does not support auto-generated keys.

      Specified by:
      prepareStatement in interface Connection
      Throws:
      SQLException
    • prepareStatement

      public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
      Specified by:
      prepareStatement in interface Connection
      Throws:
      SQLException
    • prepareStatement

      public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
      The MVAConnection implementation of prepareStatement(String, String[]) always throws SQLFeatureNotSupportedException. The IOM JDBC driver does not support auto-generated keys.

      Specified by:
      prepareStatement in interface Connection
      Throws:
      SQLException
    • releaseSavepoint

      public void releaseSavepoint(Savepoint savepoint) throws SQLException
      The MVAConnection implementation of releaseSavepoint always throws SQLFeatureNotSupportedException. The IOM JDBC driver does not support transactions.

      Specified by:
      releaseSavepoint in interface Connection
      Throws:
      SQLException
    • rollback

      public void rollback(Savepoint savepoint) throws SQLException
      The MVAConnection implementation of rollback always throws SQLFeatureNotSupportedException. The IOM JDBC driver does not support transactions.

      Specified by:
      rollback in interface Connection
      Throws:
      SQLException
    • setHoldability

      public void setHoldability(int holdability) throws SQLException
      The MVAConnection implementation of setHoldability(int) only supports ResultSet.CLOSE_CURSORS_AT_COMMIT for holdability.

      Specified by:
      setHoldability in interface Connection
      Throws:
      SQLException
    • setSavepoint

      public Savepoint setSavepoint() throws SQLException
      The MVAConnection implementation of setSavepoint() always throws SQLFeatureNotSupportedException. The IOM JDBC driver does not support transactions.

      Specified by:
      setSavepoint in interface Connection
      Throws:
      SQLException
    • setSavepoint

      public Savepoint setSavepoint(String name) throws SQLException
      The MVAConnection implementation of setSavepoint(String) always throws SQLFeatureNotSupportedException. The IOM JDBC driver does not support transactions.

      Specified by:
      setSavepoint in interface Connection
      Throws:
      SQLException
    • createClob

      public Clob createClob() throws SQLException
      This method is not supported.

      Constructs an object that implements the Clob interface. The object returned initially contains no data. The setAsciiStream, setCharacterStream and setString methods of the Clob interface may be used to add data to the Clob.

      Specified by:
      createClob in interface Connection
      Throws:
      SQLException - Always thrown, to indicate that this method is not implemented.

      Since:
      1.6
    • createBlob

      public Blob createBlob() throws SQLException
      This method is not supported.

      Constructs an object that implements the Blob interface. The object returned initially contains no data. The setBinaryStream and setBytes methods of the Blob interface may be used to add data to the Blob.

      Specified by:
      createBlob in interface Connection
      Throws:
      SQLException - Always thrown, to indicate that this method is not implemented.

      Since:
      1.6
    • createNClob

      public NClob createNClob() throws SQLException
      This method is not supported.

      Constructs an object that implements the NClob interface. The object returned initially contains no data. The setAsciiStream, setCharacterStream and setString methods of the NClob interface may be used to add data to the NClob.

      Specified by:
      createNClob in interface Connection
      Throws:
      SQLException - Always thrown, to indicate that this method is not implemented.

      Since:
      1.6
    • createSQLXML

      public SQLXML createSQLXML() throws SQLException
      This method is not supported.

      Constructs an object that implements the SQLXML interface. The object returned initially contains no data. The createXmlStreamWriter object and setString method of the SQLXML interface may be used to add data to the SQLXML object.

      Specified by:
      createSQLXML in interface Connection
      Throws:
      SQLException - Always thrown, to indicate that this method is not implemented.

      Since:
      1.6
    • isValid

      public boolean isValid(int timeout) throws SQLException
      Specified by:
      isValid in interface Connection
      Throws:
      SQLException
    • setClientInfo

      public void setClientInfo(String name, String value) throws SQLClientInfoException
      The MVAConnection implementation of setClientInfo(String, String) adds a warning to the Connection object for any property provided. The IOM JDBC Driver does not support the ability to set or retrieve client info properties.

      Specified by:
      setClientInfo in interface Connection
      Throws:
      SQLClientInfoException
    • setClientInfo

      public void setClientInfo(Properties properties) throws SQLClientInfoException
      The MVAConnection implementation of setClientInfo(Properties) adds a warning to the Connection object for all properties provided. The IOM JDBC Driver does not support the ability to set or retrieve client info properties.

      Specified by:
      setClientInfo in interface Connection
      Throws:
      SQLClientInfoException
    • getClientInfo

      public String getClientInfo(String name) throws SQLException
      The MVAConnection implementation of getClientInfo(String) always returns null. The IOM JDBC Driver does not support the ability to set or retrieve client info properties.

      Specified by:
      getClientInfo in interface Connection
      Throws:
      SQLException
    • getClientInfo

      public Properties getClientInfo() throws SQLException
      The MVAConnection implementation of getClientInfo always returns an empty properties object. The IOM JDBC Driver does not support the ability to set or retrieve client info properties.

      Specified by:
      getClientInfo in interface Connection
      Throws:
      SQLException
    • createArrayOf

      public Array createArrayOf(String typeName, Object[] elements) throws SQLException
      This method is not supported.

      Factory method for creating Array objects.

      Note: When createArrayOf is used to create an array object that maps to a primitive data type, then it is implementation-defined whether the Array object is an array of that primitive data type or an array of Object.

      Note: The JDBC driver is responsible for mapping the elements Object array to the default JDBC SQL type defined in java.sql.Types for the given class of Object. The default mapping is specified in Appendix B of the JDBC specification. If the resulting JDBC type is not the appropriate type for the given typeName then it is implementation defined whether an SQLException is thrown or the driver supports the resulting conversion.

      Specified by:
      createArrayOf in interface Connection
      Parameters:
      typeName - the SQL name of the type the elements of the array map to. The typeName is a database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This is the value returned by Array.getBaseTypeName
      elements - the elements that populate the returned object
      Returns:
      an Array object whose elements map to the specified SQL type

      Throws:
      SQLException - Always thrown, to indicate that this method is not implemented.

      Since:
      1.6
    • createStruct

      public Struct createStruct(String typeName, Object[] attributes) throws SQLException
      The MVAConnection implementation of createStruct(String, Object[]) always throws a SQLFeatureNotSupportedException. Base SAS does not support SQL structured types.

      Specified by:
      createStruct in interface Connection
      Throws:
      SQLException
    • unwrap

      public <T> T unwrap(Class<T> iface) throws SQLException
      Specified by:
      unwrap in interface Wrapper
      Throws:
      SQLException
    • isWrapperFor

      public boolean isWrapperFor(Class<?> iface) throws SQLException
      Specified by:
      isWrapperFor in interface Wrapper
      Throws:
      SQLException
    • abort

      public void abort(java.util.concurrent.Executor arg0) throws SQLException
      Specified by:
      abort in interface Connection
      Throws:
      SQLException
    • getNetworkTimeout

      public int getNetworkTimeout() throws SQLException
      Specified by:
      getNetworkTimeout in interface Connection
      Throws:
      SQLException
    • getSchema

      public String getSchema() throws SQLException
      Specified by:
      getSchema in interface Connection
      Throws:
      SQLException
    • setNetworkTimeout

      public void setNetworkTimeout(java.util.concurrent.Executor arg0, int arg1) throws SQLException
      Specified by:
      setNetworkTimeout in interface Connection
      Throws:
      SQLException
    • setSchema

      public void setSchema(String arg0) throws SQLException
      Specified by:
      setSchema in interface Connection
      Throws:
      SQLException