如何在JDBC数据源级别限制从Oracle返回的行数?
Is there a way to limit the rows returned at the Oracle datasource level in a Tomcat application?
有没有办法限制Tomcat应用程序中Oracle数据源级别返回的行?
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.
似乎只有在Java代码中的数据源上设置maxRows才可用。在数据源上放置maxRows =“2”不适用。
Is there any other way limit the rows returned? Without a code change?
有没有其他方法限制返回的行?没有代码更改?
6 个解决方案
#1
4
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.
它不是配置级别可用的东西。您可能需要仔细检查它是否按照您的意愿执行操作:请参阅setMaxRows的javadoc。对于Oracle,它仍然会为查询提取每一行,然后只删除范围之外的那些。您确实需要使用rownum使其与Oracle良好协作,您无法在配置中执行此操作。