本文整理汇总了Java中org.h2.Driver.load方法的典型用法代码示例。如果您正苦于以下问题:Java Driver.load方法的具体用法?Java Driver.load怎么用?Java Driver.load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.h2.Driver
的用法示例。
在下文中一共展示了Driver.load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beforeTest
import org.h2.Driver; //导入方法依赖的package包/类
/**
* This method is called before a complete set of tests is run. It deletes
* old database files in the test directory and trace files. It also starts
* a TCP server if the test uses remote connections.
*/
public void beforeTest() throws SQLException {
Driver.load();
FileUtils.deleteRecursive(TestBase.BASE_TEST_DIR, true);
DeleteDbFiles.execute(TestBase.BASE_TEST_DIR, null, true);
FileUtils.deleteRecursive("trace.db", false);
if (networked) {
String[] args = ssl ? new String[] { "-tcpSSL", "-tcpPort", "9192" }
: new String[] { "-tcpPort", "9192" };
server = Server.createTcpServer(args);
try {
server.start();
} catch (SQLException e) {
System.out.println("FAIL: can not start server (may already be running)");
server = null;
}
}
}
示例2: testDriverObject
import org.h2.Driver; //导入方法依赖的package包/类
private void testDriverObject() throws Exception {
Driver instance = Driver.load();
assertTrue(DriverManager.getDriver("jdbc:h2:~/test") == instance);
Driver.unload();
try {
java.sql.Driver d = DriverManager.getDriver("jdbc:h2:~/test");
fail(d.toString());
} catch (SQLException e) {
// ignore
}
Driver.load();
assertTrue(DriverManager.getDriver("jdbc:h2:~/test") == instance);
}
示例3: before
import org.h2.Driver; //导入方法依赖的package包/类
@Override
protected void before() throws Throwable {
loadScript();
Driver.load();
String user = "sa";
keepAlive = DriverManager.getConnection(connectionString, "sa", "");
if (!sqls.isEmpty()) {
Statement statement = keepAlive.createStatement();
for (String sql : sqls) {
statement.addBatch(sql.trim());
}
statement.executeBatch();
keepAlive.commit();
}
}
示例4: newConnection
import org.h2.Driver; //导入方法依赖的package包/类
Connection newConnection() throws SQLException {
System.out.println("url="+url);
org.h2.Driver driver = Driver.load();
Properties props = new Properties();
props.setProperty("user", user);
props.setProperty("password", password);
return driver.connect(url, props);
}
示例5: simpleDataSourceUrl
import org.h2.Driver; //导入方法依赖的package包/类
@Test
public void simpleDataSourceUrl() {
SimpleDriverDataSource dataSource = new SimpleDriverDataSource(Driver.load(), "jdbc:test-url");
assertEquals("jdbc:test-url", this.dataSourceUtils.getUrl(dataSource));
}