一个Statsment对象一次只能查询出一个结果集,如果原来的结果集是打开的,在试图创建第二个结果集时,不能成功,其是关闭的。如果要同时执行两个结果集,则应该创建两个Statsment对象,分别处理。如果不是同时处理,则可以降低一个结果集关闭后产生第二个结果集。下面的是jdk文档对Statsment的描述: The object used for executing a static SQL statement and returning the results it produces. By default, only one ResultSet object per Statement object can be open at the same time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All execution methods in the Statement interface implicitly close a statment's current ResultSet object if an open one exists.
Statement statement1=connection.createStatement();
ResultSet srs=statement1.executeQuery(sql);Statement statement2=connection.createStatement();
ResultSet rrs=statement2.executeQuery(sql);出现[Microsoft][ODBC SQL Server Driver]连接占线导致另一个 hstmt
这个错误
若是想修改结果集的话,就不能使用jdbc_odbc桥,因为这样生成的结果集是不可变和不支持滚动光标的,即是你设定createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
也一样没有用!!!
使用jdbc驱动吧
The object used for executing a static SQL statement and returning the results it produces. By default, only one ResultSet object per Statement object can be open at the same time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All execution methods in the Statement interface implicitly close a statment's current ResultSet object if an open one exists.