好象和游标缓存有关系,侃侃你tomcat的配置。

解决方案 »

  1.   

    在Server.xml中有以下一段,不过我上面的代码是直接连接的,不是通过JNDI。
    除此之外再也没有什么特别的地方了
    <Context debug="0" docBase="fx" path="/fx" >
      <Resource name="DataSource" auth="Container" type="javax.sql.DataSource"/>
      <ResourceParams name="DataSource">
        <parameter>
          <name>user</name>
          <value>sa</value>
        </parameter>
        <parameter>
          <name>password</name>
          <value></value>
        </parameter>
        <parameter>
          <name>driverClassName</name>
          <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
        </parameter>
        <parameter>
          <name>driverName</name>
          <value>jdbc:microsoft:sqlserver://liuaj:1433;DatabaseName=dps;SelectMethod=cursor</value>
        </parameter>
        </ResourceParams>
    </Context>
      

  2.   

    关于数据库结果集是否可滚动的判定
    TYPE_FORWARD_ONLY 这种类型的结果集只支持向前滚动
    TYPE_SCROLL_INSENSITIVE 这种类型的结果集支持双向滚动
    TYPE_SCROLL_SENSITIVE 这种类型的结果集,在结果集得到后,对数据所作的修改很敏感。例如:如果查询返回10行数据,而若另一个应用程序删除了其中的2行,那么,这个结果集中就只有8行数据了。应当确定jdbc驱动程序是否支持这些特征:public void testScrollable() throws SQLException
    {
    boolean supports;
    DatabaseMetaData md = connection.getMetaData(); supports = md.supportsResultSetType(ResultSet.TYPE_FORWORD_ONLY);
    if(supports)
    {
    System.out.println("TYPE_FORWORD_ONLY - Supports");
    }
    else
    {
    System.out.println("TYPE_FORWORD_ONLY - Does not support");
    } supports = md.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE);
    if(supports)
    {
    System.out.println("TYPE_SCROLL_INSENSITIVE - Supports");
    }
    else
    {
    System.out.println("TYPE_SCROLL_INSENSITIVE - Does not support");
    } supports = md.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE);
    if(supports)
    {
    System.out.println("TYPE_SCROLL_SENSITIVE - Supports");
    }
    else
    {
    System.out.println("TYPE_SCROLL_SENSITIVE - Does not support");
    }
    }