Methods Summary |
---|
public static java.sql.Connection | getConnection()
return DriverManager.getConnection(Support_SQL.sqlUrl,
Support_SQL.sqlLogin, Support_SQL.sqlPassword);
|
public static java.sql.Connection | getConnection(java.lang.String url, java.lang.String login, java.lang.String password)
return DriverManager.getConnection(url, login, password);
|
public static java.lang.String | getFilename()
return dbFile.getPath();
|
public static boolean | isEqual(byte[] b1, int off1, byte[] b2, int off2, int len)
for (int i = 0; i < len; ++i)
if (b1[i + off1] != b2[i + off2])
return false;
return true;
|
public static void | loadDriver()
try {
loadProperties(Class.forName("tests.support.Support_SQL")
.getResourceAsStream("/connection.properties"));
String tmp = System.getProperty("java.io.tmpdir");
File tmpDir = new File(tmp);
if (tmpDir.isDirectory()) {
dbFile = File.createTempFile("sqliteTest", ".db", tmpDir);
dbFile.deleteOnExit();
} else {
System.err.println("java.io.tmpdir does not exist");
}
Class.forName("SQLite.JDBCDriver").newInstance();
// overwrite sqlUrl to point to valid directory
sqlUrl = "jdbc:sqlite:/" + dbFile.getPath();
Class.forName(sqlDriver).newInstance();
} catch (Exception ex) {
System.err.println("Unexpected exception " + ex.toString());
}
|
private static void | loadProperties(java.io.InputStream fileName)
Properties properties = new Properties();
properties.load(fileName);
sqlDriver = properties.getProperty("sqlDriver");
sqlLogin = properties.getProperty("sqlLogin");
sqlCatalog = properties.getProperty("sqlCatalog");
sqlHost = properties.getProperty("sqlHost");
sqlUrl = properties.getProperty("sqlUrlPrefix") + sqlHost + "/"
+ sqlCatalog;
sqlPassword = properties.getProperty("sqlPassword");
sqlUser = properties.getProperty("sqlUser");
sqlMaxConnections = Integer.parseInt(properties
.getProperty("sqlMaxConnections"));
sqlMaxTasks = Integer.parseInt(properties.getProperty("sqlMaxTasks"));
|