public class RCData extends Object
The file src/org/hsqldb/sample/SqlFileEmbedder.java
in the HSQLDB distribution provides an example of how to use RCData for your
own programs.
SqlFileEmbedder
Modifier and Type | Field and Description |
---|---|
String |
charset |
static String |
DEFAULT_JDBC_DRIVER |
String |
driver |
String |
id |
String |
libpath |
String |
password |
String |
ti |
String |
truststore |
String |
url |
String |
username |
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
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.
|
public static final String DEFAULT_JDBC_DRIVER
public String id
public String url
public String username
public String password
public String ti
public String driver
public String charset
public String truststore
public String libpath
public RCData(File file, String dbKey) throws Exception
file
- File containing the authentication information.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).Exception
- any exceptionpublic RCData(String id, String url, String username, String password, String driver, String charset, String truststore) throws Exception
Exception
RCData(String,String,String,String,String,String,String,String)
public RCData(String id, String url, String username, String password, String driver, String charset, String truststore, String libpath) throws Exception
Exception
public RCData(String id, String url, String username, String password, String driver, String charset, String truststore, String libpath, String ti) throws Exception
RCData
object.
The parameters driver, charset, truststore, and libpath are optional.
Setting these parameters to NULL
will set them to their
default values.
id
- The identifier for these connection settingsurl
- The URL of the database to connect tousername
- The username to log in aspassword
- The password of the usernamedriver
- The JDBC driver to usecharset
- The character set to usetruststore
- The trust store to uselibpath
- The JDBC library to add to CLASSPATHti
- The transaction levelException
- if the a non-optional parameter is set to NULL
public void setDefaultJdbcDriver(String defaultJdbcDriverName)
public String getDefaultJdbcDriverName()
public Connection getConnection() throws ClassNotFoundException, SQLException, MalformedURLException
ClassNotFoundException
- on class not foundSQLException
- on database access errorMalformedURLException
- on malformed URLpublic Connection getConnection(String curDriverIn, String curTrustStoreIn) throws ClassNotFoundException, MalformedURLException, SQLException
curDriverIn
- drivercurTrustStoreIn
- trusted storeClassNotFoundException
- on class not foundMalformedURLException
- on malformed URLSQLException
- on database access errorpublic static String expandSysPropVars(String inString)
${system.property}
replaced by the corresponding Java
System Properties.public static void setTI(Connection c, String tiString) throws SQLException
SQLException
public static String tiToString(int ti)
Database implementations are free to provide their own transaction isolation levels, so you can't depend upon this method to much.
ti
- Transaction levleCopyright © 2001 - 2017 HSQL Development Group.