add h2 support

This commit is contained in:
wenshao
2012-07-09 08:48:23 +08:00
parent c1d304bf2e
commit 81533cfd0e
6 changed files with 84 additions and 32 deletions
@@ -37,7 +37,7 @@ public class Case0 extends TestCase {
private String user;
private String password;
private String driverClass;
private int initialSize = 10;
private int initialSize = 1;
private int minIdle = 3;
private int maxIdle = 8;
private int maxActive = 8;
@@ -0,0 +1,50 @@
package com.alibaba.druid.bvt.pool;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import junit.framework.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
public class TestH2 extends TestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:h2:mem:");
dataSource.setPoolPreparedStatements(true);
dataSource.setMaxOpenPreparedStatements(10);
dataSource.init();
}
protected void tearDown() throws Exception {
JdbcUtils.close(dataSource);
}
public void test_h2() throws Exception {
Assert.assertSame(JdbcUtils.H2, dataSource.getDbType());
Connection conn = dataSource.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT ?");
stmt.setString(1, "xxxx");
ResultSet rs = stmt.executeQuery();
rs.next();
Assert.assertEquals("xxxx", rs.getString(1));
rs.close();
stmt.close();
conn.close();
}
}
@@ -26,7 +26,7 @@ import com.alibaba.druid.sql.dialect.oracle.visitor.OracleOutputVisitor;
public class CallTest extends TestCase {
public void test_select() throws Exception {
String sql = "CALL test(1)";
String sql = "call dbms_session.set_identifier('nfs_special_syncview')";
OracleStatementParser parser = new OracleStatementParser(sql);
List<SQLStatement> statementList = parser.parseStatementList();