Ibatis.net Execute SQL timeout commandtimeout a pit

Source: Internet
Author: User
Tags mysql connection string

Ibatis.net is used in the project, the database is MySQL, when doing a batch update operation, need to execute 40 seconds, in execution to 30 seconds, will throw an exception: timeout expired, the timeout period elapsed Prior to completion of the operation or the server was not responding

Online A check, said set MySQL command timeout, so in Ibatis.net's Providers.config file set the commandtimeout= "600" parameter.

Results a test, or an error, the same anomaly ...

No way, can only trace the source of ibatis.net, finally found the Sqlmapsession.createcommand this method has a pit ... is to put _connection. ConnectionTimeout assigned to the command.commandtimeout ...

This is even annotated with MYSQL provider doesn ' t support it!

Fortunately, found the reason, can solve, in the MySQL connection string to add

Connect timeout=600 So ibatis.net will assign it to command.commandtimeout test no longer error, OK problem solved

Ibatis.net Execute SQL timeout commandtimeout a pit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.