如何在JDBC数据源级别限制从Oracle返回的行数? [英] How to limit number of rows returned from Oracle at the JDBC data source level?

查看:345
本文介绍了如何在JDBC数据源级别限制从Oracle返回的行数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有办法限制Tomcat应用程序在Oracle数据源级别返回的行?

Is there a way to limit the rows returned at the Oracle datasource level in a Tomcat application?

似乎只有在Java代码中的数据源上设置maxRows时,该选项才可用.将maxRows="2"放在数据源上不适用.

It seems maxRows is only available if you set it on the datasource in the Java code. Putting maxRows="2" on the datasource doesn't apply.

还有其他方法可以限制返回的行吗?无需更改代码?

Is there any other way limit the rows returned? Without a code change?

推荐答案

在配置级别上不可用.您可能要仔细检查它是否确实可以执行您想做的事情:

It isn't something that is available at the configuration level. You may want to double check that it does what you want it to do anyway: see the javadoc for setMaxRows. With Oracle it is still going to fetch every row back for the query and then just drop the ones outside the range. You would really need to use rownum to make it work well with Oracle and you can't do that either in the configuration.

这篇关于如何在JDBC数据源级别限制从Oracle返回的行数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆