|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hsqldb.lib.RCData
public class RCData
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.
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 |
---|
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
Constructor Detail |
---|
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 level
Exception
- if the a non-optional parameter is set to NULL
Method Detail |
---|
public void setDefaultJdbcDriver(String defaultJdbcDriverName)
public String getDefaultJdbcDriverName()
public Connection getConnection() throws ClassNotFoundException, SQLException, MalformedURLException
ClassNotFoundException
- on class not found
SQLException
- on database access error
MalformedURLException
- on malformed URLpublic Connection getConnection(String curDriverIn, String curTrustStoreIn) throws ClassNotFoundException, MalformedURLException, SQLException
curDriverIn
- drivercurTrustStoreIn
- trusted store
ClassNotFoundException
- on class not found
MalformedURLException
- on malformed URL
SQLException
- 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 levle
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |