## org.hsqldb.lib
Class RCData

    java.lang.Object
      org.hsqldb.lib.RCData

    public class RCData

extends Object

Manages all the details we need to connect up to JDBC database(s), in a declarative way.

The file `src/org/hsqldb/sample/SqlFileEmbedder.java` in the HSQLDB distribution provides an example of how to use RCData for your own programs.

Author:
  Blaine Simpson (blaine dot simpson at admc dot com)
See Also:
  The RC File section of the HyperSQL Utilities Guide, `SqlFileEmbedder`

Field Summary
`String` `charset`
`static String` `DEFAULT_JDBC_DRIVER`
`String` `driver`
`String` `id`
`String` `libpath`
`String` `password`
`String` `ti`
`String` `truststore`
`String` `url`
`String` `username`

Constructor Summary
`RCData(File file, String dbKey)` Creates a RCDataObject by looking up the given key in the given authentication file.
`RCData(String id, String url, String username, String password, String driver, String charset, String truststore)` Convenience constructor for backward compatibility.
`RCData(String id, String url, String username, String password, String driver, String charset, String truststore, String libpath)` Wrapper for unset Transaction Isolation.
`RCData(String id, String url, String username, String password, String driver, String charset, String truststore, String libpath, String ti)` Creates a new `RCData` object.

Method Summary
`static String` `expandSysPropVars(String inString)` Returns a copy of the given String with System property names in the format `${system.property}` replaced by the corresponding Java System Properties.
`Connection` `getConnection()` Gets a JDBC Connection using the data of this RCData object.
`Connection` `getConnection(String curDriverIn, String curTrustStoreIn)` Gets a JDBC Connection using the data of this RCData object with specified override elements
`String` `getDefaultJdbcDriverName()`
`void` `setDefaultJdbcDriver(String defaultJdbcDriverName)`
`static void` `setTI(Connection c, String tiString)` Set Transaction Isolation level on the specified JDBC Connection
`static String` `tiToString(int ti)` Return a String representation for the given numerical java.sql.Connection Transaction level.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_JDBC_DRIVER

    public static final String DEFAULT_JDBC_DRIVER

See Also:
  Constant Field Values

### id

    public String id

### url

    public String url

### username

    public String username

### password

    public String password

### ti

    public String ti

### driver

    public String driver

### charset

    public String charset

### truststore

    public String truststore

### libpath

    public String libpath

Constructor Detail

### RCData

    public RCData(File file,
                  String dbKey)
           throws Exception

  Creates a RCDataObject by looking up the given key in the given authentication file.

  Parameters:
    `dbKey` - Key to look up in the file. If null, then will echo all urlids in the file to stdout. (A rather ill-conceived design).
    `file` - File containing the authentication information.
  Throws:
    `Exception`

### RCData

    public RCData(String id,
                  String url,
                  String username,
                  String password,
                  String driver,
                  String charset,
                  String truststore)
           throws Exception

  Convenience constructor for backward compatibility.

  Throws:
    `Exception`
  See Also:
    `RCData(String,String,String,String,String,String,String,String)`

### RCData

    public RCData(String id,
                  String url,
                  String username,
                  String password,
                  String driver,
                  String charset,
                  String truststore,
                  String libpath)
           throws Exception

  Wrapper for unset Transaction Isolation.

  Throws:
    `Exception`

### RCData

    public RCData(String id,
                  String url,
                  String username,
                  String password,
                  String driver,
                  String charset,
                  String truststore,
                  String libpath,
                  String ti)
           throws Exception

  Creates a new `RCData` object.

  The parameters driver, charset, truststore, and libpath are optional. Setting these parameters to `NULL` will set them to their default values.

  Parameters:
    `id` - The identifier for these connection settings
    `url` - The URL of the database to connect to
    `username` - The username to log in as
    `password` - The password of the username
    `driver` - The JDBC driver to use
    `charset` - The character set to use
    `truststore` - The trust store to use
    `libpath` - The JDBC library to add to CLASSPATH
  Throws:
    `Exception` - if the a non-optional parameter is set to `NULL`

Method Detail

### setDefaultJdbcDriver

    public void setDefaultJdbcDriver(String defaultJdbcDriverName)

### getDefaultJdbcDriverName

    public String getDefaultJdbcDriverName()

### getConnection

    public Connection getConnection()
                             throws ClassNotFoundException,
                                    SQLException,
                                    MalformedURLException

  Gets a JDBC Connection using the data of this RCData object.

  Returns:
    New JDBC Connection
  Throws:
    `ClassNotFoundException`
    `SQLException`
    `MalformedURLException`

### getConnection

    public Connection getConnection(String curDriverIn,
                                    String curTrustStoreIn)
                             throws ClassNotFoundException,
                                    MalformedURLException,
                                    SQLException

  Gets a JDBC Connection using the data of this RCData object with specified override elements

  Returns:
    New JDBC Connection
  Throws:
    `ClassNotFoundException`
    `MalformedURLException`
    `SQLException`

### expandSysPropVars

    public static String expandSysPropVars(String inString)

  Returns a copy of the given String with System property names in the format `${system.property}` replaced by the corresponding Java System Properties.

### setTI

    public static void setTI(Connection c,
                             String tiString)
                      throws SQLException

  Set Transaction Isolation level on the specified JDBC Connection

  Throws:
    `SQLException`

### tiToString

    public static String tiToString(int ti)

  Return a String representation for the given numerical java.sql.Connection Transaction level.

  Database implementations are free to provide their own transaction isolation levels, so you can't depend upon this method to much.

  Returns null, since DB implementations are free to provide

Copyright © 2001 - 2013 HSQL Development Group.