java 指定 IBatis 查询超时
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3866045/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Specify IBatis query timeout
提问by Victor
There is a way to specify IBatis query timeout using oracle jdbc and Java?
有没有办法使用oracle jdbc 和Java 指定IBatis 查询超时?
Thanks
谢谢
回答by Peter Tillemans
From the iBatis manual :
从 iBatis 手册:
in the <settings>
element :
在<settings>
元素中:
defaultStatementTimeout
默认语句超时
(iBATIS versions 2.2.0 and later) This setting is an integer value that will be applied as the JDBC query timeout for all statements. This value can be overridden with the “statement” attribute of any mapped statement. If not specified, no query timeout will be set unless specified on the “statement” attribute of a mapped statement. The specified value is the number of seconds the driver will wait for a statement to finish. Note that not all drivers support this setting.
(iBATIS 2.2.0 及更高版本)此设置是一个整数值,将用作所有语句的 JDBC 查询超时。该值可以被任何映射语句的“statement”属性覆盖。如果未指定,除非在映射语句的“statement”属性上指定,否则不会设置查询超时。指定的值是驱动程序将等待语句完成的秒数。请注意,并非所有驱动程序都支持此设置。
on the statement paremeters :
在语句参数上:
timeout
暂停
(iBATIS versions 2.2.0 and later only)
(仅限 iBATIS 2.2.0 及更高版本)
Sets the JDBC query timeout for this statement. Any value specified here will override the value specified in the “defaultStatementTimeout” setting in the SQLMapConfig.xml file. If you specify a default timeout and decide that you don't want a timeout for a particular statement, set the timeout value to 0. The specified value is the number of seconds the driver will wait for a statement to finish. Note that not all drivers support this setting.
设置此语句的 JDBC 查询超时。此处指定的任何值都将覆盖 SQLMapConfig.xml 文件中“defaultStatementTimeout”设置中指定的值。如果您指定默认超时并决定不希望特定语句超时,请将超时值设置为 0。指定的值是驱动程序将等待语句完成的秒数。请注意,并非所有驱动程序都支持此设置。
The oracle drivers support this functionality, so this should work.
oracle 驱动程序支持此功能,因此这应该可以工作。