All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sas.storage.jdbc
Class JDBCConnection

    com.sas.storage.jdbc.JDBCConnection

All Implemented Interfaces:
  java.sql.Connection, java.sql.Wrapper

    public class JDBCConnection

implements java.sql.Connection

JDBCConnection is an implementation of `java.sql.Connection` interface. All of the implemented methods delegate to an actual `java.sql.Connection` object created using the DriverManager create methods. This class is meant to allow users to set the information needed to create a `java.sql.Connection` in webAF and to hook up the Connection to a dataBean. If this class in instantiated while at designTime, no connection is created. To allow a programmer to get information from a user of their applet, the loginCommand can be set. The command will be executed before attempting to create the connection. The JDBCConnection instance will be passed to the `command.execute(Object)` method. In order to use default sun.jdbc.odbc.JdbcOdbcDriver in an applet, the applet will need to be signed or the user's policy file changed. If this is not done, a SQLException will be thrown with the message: No suitable driver.

Field Summary
`protected java.sql.Connection` | `connection`
`protected java.util.Properties` | `connectionInfo`
`protected java.lang.String` | `databaseURL`
`protected boolean` | `designTime`
`protected java.lang.Class` | `driverClass`
`protected java.lang.String` | `driverName`
`protected com.sas.util.Command` | `loginCmd`
`protected java.lang.String` | `password`
`static java.lang.String` | `RB_KEY`
`protected javax.swing.event.SwingPropertyChangeSupport` | `spcs` Used to support property changes in the webAF customizer
`protected java.lang.String` | `user`

Constructor Summary
`JDBCConnection()` Constructor for the JDBCConnection.

Method Summary
`void` | `addPropertyChangeListener(java.beans.PropertyChangeListener listener)` Adds a PropertyChangeListener to the listener list.
`void` | `clearWarnings()` Implementation of the java.sql.Connection interface.
`void` | `close()` Implementation of the java.sql.Connection interface.
`void` | `commit()` Implementation of the java.sql.Connection interface.
`protected java.sql.Connection` | `createConnection()` Create the Connection object used to delegate all Connection method calls to.
`java.sql.Statement` | `createStatement()` Implementation of the java.sql.Connection interface.
`java.sql.Statement` | `createStatement(int resultSetType, int resultSetConcurrency)` Implementation of the java.sql.Connection interface.
`java.sql.Statement` | `createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)` Implementation of the java.sql.Connection interface.
`boolean` | `getAutoCommit()` Implementation of the java.sql.Connection interface.
`java.lang.String` | `getCatalog()` Implementation of the java.sql.Connection interface.
`java.sql.Connection` | `getConnection()` Get the connection used by this class to delegate to for implementation methods of java.sql.Connection interface.
`java.util.Properties` | `getConnectionInfo()` Get the Properties object used to get a connection from the DriverManager.
`java.lang.String` | `getDatabaseURL()` Get the Database URL used to get a connection from the DriverManager.
`java.lang.String` | `getDriverName()` Get the name of the Driver class for this Connection.
`static com.sas.beans.ExtendedBeanInfo` | `getExtendedBeanInfo()`
`int` | `getHoldability()` Implementation of the java.sql.Connection interface.
`com.sas.util.Command` | `getLoginCommand()` Get the Command object to be executed before attempting to load the Driver or find a Connection.
`java.sql.DatabaseMetaData` | `getMetaData()` Implementation of the java.sql.Connection interface.
`java.lang.String` | `getPassword()` Get the password used to get a connection from the DriverManager.
`int` | `getTransactionIsolation()` Implementation of the java.sql.Connection interface.
`java.util.Map` | `getTypeMap()` Implementation of the java.sql.Connection interface.
`java.lang.String` | `getUsername()` Get the username used to get a connection from the DriverManager.
`java.sql.SQLWarning` | `getWarnings()` Implementation of the java.sql.Connection interface.
`boolean` | `isClosed()` Implementation of the java.sql.Connection interface.
`boolean` | `isReadOnly()` Implementation of the java.sql.Connection interface.
`java.lang.String` | `nativeSQL(java.lang.String sql)` Implementation of the java.sql.Connection interface.
`java.sql.CallableStatement` | `prepareCall(java.lang.String sql)` Implementation of the java.sql.Connection interface.
`java.sql.CallableStatement` | `prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)` Implementation of the java.sql.Connection interface.
`java.sql.CallableStatement` | `prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)` Implementation of the java.sql.Connection interface.
`java.sql.PreparedStatement` | `prepareStatement(java.lang.String sql)` Implementation of the java.sql.Connection interface.
`java.sql.PreparedStatement` | `prepareStatement(java.lang.String sql, int autoGeneratedKeys)` Implementation of the java.sql.Connection interface.
`java.sql.PreparedStatement` | `prepareStatement(java.lang.String sql, int[] columnIndexes)` Implementation of the java.sql.Connection interface.
`java.sql.PreparedStatement` | `prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)` Implementation of the java.sql.Connection interface.
`java.sql.PreparedStatement` | `prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)` Implementation of the java.sql.Connection interface.
`java.sql.PreparedStatement` | `prepareStatement(java.lang.String sql, java.lang.String[] columnNames)` Implementation of the java.sql.Connection interface.
`void` | `releaseSavepoint(java.sql.Savepoint savepoint)` Implementation of the java.sql.Connection interface.
`void` | `removePropertyChangeListener(java.beans.PropertyChangeListener listener)` Removes a PropertyChangeListener from the listener list.
`void` | `resetConnection()` Reset the connection used by this class.
`void` | `rollback()` Implementation of the java.sql.Connection interface.
`void` | `rollback(java.sql.Savepoint savepoint)` Implementation of the java.sql.Connection interface.
`void` | `setAutoCommit(boolean autoCommit)` Implementation of the java.sql.Connection interface.
`void` | `setCatalog(java.lang.String catalog)` Implementation of the java.sql.Connection interface.
`void` | `setConnectionInfo(java.util.Properties info)` Set the Connection information Properties object.
`void` | `setDatabaseURL(java.lang.String url)` Set the database URL that this connection will connect to.
`void` | `setDriverName(java.lang.String driver)` Set the name of the Driver class for this Connection.
`void` | `setHoldability(int holdability)` Implementation of the java.sql.Connection interface.
`void` | `setLoginCommand(com.sas.util.Command command)` Set the login Command.
`void` | `setPassword(java.lang.String password)` Set the password used to get a connection from the DriverManager.
`void` | `setReadOnly(boolean readOnly)` Implementation of the java.sql.Connection interface.
`java.sql.Savepoint` | `setSavepoint()` Implementation of the java.sql.Connection interface.
`java.sql.Savepoint` | `setSavepoint(java.lang.String name)` Implementation of the java.sql.Connection interface.
`void` | `setTransactionIsolation(int level)` Implementation of the java.sql.Connection interface.
`void` | `setTypeMap(java.util.Map typeMap)` Implementation of the java.sql.Connection interface.
`void` | `setUsername(java.lang.String username)` Set the username used to get a connection from the DriverManager.

Field Detail

### RB_KEY

    public static final java.lang.String RB_KEY

See Also:
  Constant Field Values

### designTime

    protected boolean designTime

### connection

    protected java.sql.Connection connection

### driverName

    protected java.lang.String driverName

### databaseURL

    protected java.lang.String databaseURL

### user

    protected java.lang.String user

### password

    protected java.lang.String password

### connectionInfo

    protected java.util.Properties connectionInfo

### driverClass

    protected java.lang.Class driverClass

### loginCmd

    protected com.sas.util.Command loginCmd

### spcs

    protected javax.swing.event.SwingPropertyChangeSupport spcs

  Used to support property changes in the webAF customizer

Constructor Detail

### JDBCConnection

    public JDBCConnection()

  Constructor for the JDBCConnection. Checks the designTime state at this time.

Method Detail

### getExtendedBeanInfo

    public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()

### getPassword

    public java.lang.String getPassword()

  Get the password used to get a connection from the DriverManager.

  Returns:
    the password string

### setPassword

    public void setPassword(java.lang.String password)

  Set the password used to get a connection from the DriverManager. If the connectionInfo property has been set already, the password will NOT be put into it.

  Parameters:
    `password` - the password string

### getUsername

    public java.lang.String getUsername()

  Get the username used to get a connection from the DriverManager.

  Returns:
    the username string

### setUsername

    public void setUsername(java.lang.String username)

  Set the username used to get a connection from the DriverManager. If the connectionInfo property has been set already, the username will NOT be put into it.

  Parameters:
    `username` - the username string

### getConnectionInfo

    public java.util.Properties getConnectionInfo()

  Get the Properties object used to get a connection from the DriverManager.

  Returns:
    the Properties Connection information

### setConnectionInfo

    public void setConnectionInfo(java.util.Properties info)

  Set the Connection information Properties object. If this is set, the username and password will not be used to get the Connection object from the DriverManager.

  Parameters:
    `info` - the Connection Properties object

### getDatabaseURL

    public java.lang.String getDatabaseURL()

  Get the Database URL used to get a connection from the DriverManager.

  Returns:
    the database URL

### setDatabaseURL

    public void setDatabaseURL(java.lang.String url)

  Set the database URL that this connection will connect to.

  Parameters:
    `url` - the URL to connect to

### getDriverName

    public java.lang.String getDriverName()

  Get the name of the Driver class for this Connection. This is used to register the driver class before attempting to get a Connection for the specified databaseURL. If it isn't already loaded, the driver class will be loaded before the DriverManager.getConnection() method is called.

  Returns:
    the driver class name

### setDriverName

    public void setDriverName(java.lang.String driver)
                       throws java.lang.ClassNotFoundException

  Set the name of the Driver class for this Connection. This is used to register the driver class before attempting to get a Connection for the specified databaseURL. If it isn't already loaded, the driver class will be loaded before the DriverManager.getConnection() method is called.

  Parameters:
    `driver` - the driver class name
  Throws:
    `java.lang.ClassNotFoundException`

### getLoginCommand

    public com.sas.util.Command getLoginCommand()

  Get the Command object to be executed before attempting to load the Driver or find a Connection.

  Parameters:
    `the` - login command

### setLoginCommand

    public void setLoginCommand(com.sas.util.Command command)

  Set the login Command. The Command object is executed before attempting to load the Driver or find a Connection.

### createConnection

    protected java.sql.Connection createConnection()
                                            throws java.sql.SQLException

  Create the Connection object used to delegate all Connection method calls to. The loginCommand is executed first, then the driverClass is loaded. The DriverManager.getConnection method is then called. If the info Properties object is set, the `getConnection( String, Properties )` method is called. If the password or the user are not equal to null, the `getConnection( String, String, String )` method is called. Otherwise, the `getConnection( String )` method is called. The method called is based on whether the Connection info Properties object is set, the password and username, or just the databaseURL.

  Returns:
    Connection the java.sql.Connection object created using DriverManager.getConnection method
  Throws:
    `java.sql.SQLException`
  See Also:
    `DriverManager`

### resetConnection

    public void resetConnection()
                         throws java.sql.SQLException

  Reset the connection used by this class. If the connection is not null and not closed. The connection will be closed before setting it to null.

  Throws:
    `java.sql.SQLException`

### getConnection

    public java.sql.Connection getConnection()
                                      throws java.sql.SQLException

  Get the connection used by this class to delegate to for implementation methods of java.sql.Connection interface. If designTime is false, this will return null.

  Returns:
    actual Connection object delegate; or null if designTime
  Throws:
    `java.sql.SQLException`

### createStatement

    public java.sql.Statement createStatement()
                                       throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `createStatement` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### createStatement

    public java.sql.Statement createStatement(int resultSetType,
                                              int resultSetConcurrency)
                                       throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `createStatement` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### createStatement

    public java.sql.Statement createStatement(int resultSetType,
                                              int resultSetConcurrency,
                                              int resultSetHoldability)
                                       throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `createStatement` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                                throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `prepareStatement` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                       int autoGeneratedKeys)
                                                throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `prepareStatement` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                       int[] columnIndexes)
                                                throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `prepareStatement` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                       java.lang.String[] columnNames)
                                                throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `prepareStatement` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                       int resultSetType,
                                                       int resultSetConcurrency,
                                                       int resultSetHoldability)
                                                throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `prepareStatement` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### prepareCall

    public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                           throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `prepareCall` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### prepareCall

    public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                                  int resultSetType,
                                                  int resultSetConcurrency,
                                                  int resultSetHoldability)
                                           throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `prepareCall` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### nativeSQL

    public java.lang.String nativeSQL(java.lang.String sql)
                               throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `nativeSQL` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### setAutoCommit

    public void setAutoCommit(boolean autoCommit)
                       throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `setAutoCommit` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### getAutoCommit

    public boolean getAutoCommit()
                          throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return false if no connection is available.

  Specified by:
    `getAutoCommit` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### commit

    public void commit()
                throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `commit` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### rollback

    public void rollback()
                  throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `rollback` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### close

    public void close()
               throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `close` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### isClosed

    public boolean isClosed()
                     throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return true if no connection is available.

  Specified by:
    `isClosed` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### getMetaData

    public java.sql.DatabaseMetaData getMetaData()
                                          throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `getMetaData` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### setReadOnly

    public void setReadOnly(boolean readOnly)
                     throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `setReadOnly` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### isReadOnly

    public boolean isReadOnly()
                       throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return true if no connection is available or if a driver allows no updates to a database (the database is read-only).

  Specified by:
    `isReadOnly` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### setCatalog

    public void setCatalog(java.lang.String catalog)
                    throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `setCatalog` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### getCatalog

    public java.lang.String getCatalog()
                                throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `getCatalog` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### setTransactionIsolation

    public void setTransactionIsolation(int level)
                                 throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `setTransactionIsolation` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### getTransactionIsolation

    public int getTransactionIsolation()
                                throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return Connection.TRANSACTION_NONE if no connection is available.

  Specified by:
    `getTransactionIsolation` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### getWarnings

    public java.sql.SQLWarning getWarnings()
                                    throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `getWarnings` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### clearWarnings

    public void clearWarnings()
                       throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `clearWarnings` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                       int resultSetType,
                                                       int resultSetConcurrency)
                                                throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `prepareStatement` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### prepareCall

    public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                                  int resultSetType,
                                                  int resultSetConcurrency)
                                           throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `prepareCall` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### getTypeMap

    public java.util.Map getTypeMap()
                             throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `getTypeMap` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### setTypeMap

    public void setTypeMap(java.util.Map typeMap)
                    throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `setTypeMap` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

  Adds a PropertyChangeListener to the listener list. The listener is registered for all properties.

### removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

  Removes a PropertyChangeListener from the listener list.

### setHoldability

    public void setHoldability(int holdability)
                        throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `setHoldability` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### getHoldability

    public int getHoldability()
                       throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return ResultSet.HOLD_CURSORS_OVER_COMMIT if no connection is available.

  Specified by:
    `getHoldability` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### setSavepoint

    public java.sql.Savepoint setSavepoint()
                                    throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `setSavepoint` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### setSavepoint

    public java.sql.Savepoint setSavepoint(java.lang.String name)
                                    throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will return null if no connection is available.

  Specified by:
    `setSavepoint` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### rollback

    public void rollback(java.sql.Savepoint savepoint)
                  throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `rollback` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

### releaseSavepoint

    public void releaseSavepoint(java.sql.Savepoint savepoint)
                          throws java.sql.SQLException

  Implementation of the java.sql.Connection interface. This will do nothing if no connection is available.

  Specified by:
    `releaseSavepoint` in interface `java.sql.Connection`
  Throws:
    `java.sql.SQLException`

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.