不必定义两个Connection,Statement也不用定义两个,但ResultSet得定义两个,只要它们的executeQuery()中的SQL语句不同就行了。

解决方案 »

  1.   

    Only one ResultSet object per Statement object can be open at any point in 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 statement execute methods implicitly close a statment's current ResultSet object if an open one exists.
      

  2.   

    connection是可以公用的但是statement是不可以公用的