简体   繁体   English

指定IBatis查询超时

[英]Specify IBatis query timeout

There is a way to specify IBatis query timeout using oracle jdbc and Java? 有一种方法可以使用oracle jdbc和Java指定IBatis查询超时吗?

Thanks 谢谢

From the iBatis manual : 从iBatis手册:

in the <settings> element : <settings>元素中:

defaultStatementTimeout 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. (iBATIS版本2.2.0及更高版本)此设置是一个整数值,将作为所有语句的JDBC查询超时应用。 This value can be overridden with the “statement” attribute of any mapped statement. 可以使用任何映射语句的“statement”属性覆盖此值。 If not specified, no query timeout will be set unless specified on the “statement” attribute of a mapped statement. 如果未指定,则除非在映射语句的“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. 请注意,并非所有驱动程序都支持此设置

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. 设置此语句的JDBC查询超时。 Any value specified here will override the value specified in the “defaultStatementTimeout” setting in the SQLMapConfig.xml file. 此处指定的任何值都将覆盖SQLMapConfig.xml文件中“defaultStatementTimeout”设置中指定的值。 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. 如果指定默认超时并确定不希望特定语句超时,请将超时值设置为0.指定的值是驱动程序等待语句完成的秒数。 Note that not all drivers support this setting. 请注意,并非所有驱动程序都支持此设置

The oracle drivers support this functionality, so this should work. oracle驱动程序支持此功能,因此这应该可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM