在Web环境下SQL Server存储过程返回结果集如果需要滚动就出错:Error setting up static cursor cache。而在普通应用中中正常 好象和游标缓存有关系,侃侃你tomcat的配置。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在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> 关于数据库结果集是否可滚动的判定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"); }} String问题 关于接口的疑问 一个关于java的简单问题 求助,关于java命令访问jar中的class文件??? package 无法调用 javascript与applet通迅的问题? 困惑??jdk?? ● 请问:谁有日文即时转中文的工具 ● 如何连接数据库~? 求教异常 有几个问题请教,100分! J2ME和j2se有什么区别呢?
除此之外再也没有什么特别的地方了
<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>
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");
}
}