修正未关闭statement先关闭connection时的bug

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@433 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-07-14 07:47:24 +00:00
parent 60018562c3
commit 499a0f490e
4 changed files with 160 additions and 12 deletions
@@ -0,0 +1,33 @@
package com.alibaba.druid.bvt.pool;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
public class Case3 extends TestCase {
public void test_0() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setPoolPreparedStatements(true);
dataSource.close();
}
public void test_1() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT 1");
rs.next();
conn.close();
dataSource.close();
}
}