急待解决!!!看了很多帖子都不能解决用尽的ResultSet的问题,这个比较特殊,请高手进!
首先说明环境:红旗linux 5.0,Tomcat 1.4,orcale 10g
程序源码:1、采用tomcat数据库连接池配置,如下:
<Context path="/webdt" docBase="D:\Tomcat 4.1\webapps\webdt" debug="0" reloadable="true" privileged="true">
<Resource name="jdbc/OracleDS" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/OracleDS">
<parameter>
<name>username</name>
<value>system</value>
</parameter>
<parameter>
<name>password</name>
<value>system</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@192.168.6.33:1521:orcl</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>1000</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>70</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
</Context>
2、java程序调用,如下:
public Vector doQuery(String sqlStr) {
Vector result = new Vector();
if (!dbsource.equals("OracleDS")) {
ds = null;
dbsource = "OracleDS";
}
conn = getConnection();
if (!isSucc)
return null;
try {
result = doQuery(conn, sqlStr);
} finally {
try {
if (conn != null)
conn.close();
} catch (Exception e) {
System.out.println(e);
}
}
return result;
}
public Vector doQuery(Connection conn, String sqlStr) {
Statement stmt = null;
ResultSet rs = null;
if (conn == null)
return null;
Vector result = new Vector();
try {
stmt = conn.createStatement();
rs = stmt.executeQuery(sqlStr);
ResultSetMetaData rsmd = rs.getMetaData();
int num = rsmd.getColumnCount();
Hashtable row;
for (; rs.next(); result.add(row)) {
row = new Hashtable();
for (int i = 1; i <= num; i++) {
String columnType = rsmd.getColumnTypeName(i);
String key = rsmd.getColumnName(i);
if (key == null)
key = "";
String value = null;
if (columnType.equalsIgnoreCase("CLOB")) {
Clob tmpClob = rs.getClob(i);
if (tmpClob != null) {
BufferedReader bufferIn = new BufferedReader(
tmpClob.getCharacterStream());
value = "";
for (String tmpLine = ""; (tmpLine = bufferIn
.readLine()) != null;)
value = value + tmpLine;
tmpClob.getSubString(1L, (int) tmpClob.length());
} else {
value = null;
}
} else {
value = rs.getString(i);
}
if (value == null)
value = "";
row.put(key.toUpperCase(), value);
}
}
rs.close();
stmt.close();
} catch (Exception e) {
setMsg(e.toString() + "SQL:" + sqlStr);
setSucc