开发者

IBATIS - Stored procedure timeout

i have this procedure statement

<procedure id="InsertIOs" parameterMap="InsertIOsParams">
      SP_InsertIOs
    </procedure>

 </statements>

  <parameterMaps>
    <parameterMap id="InsertIOsParams">
      <parameter property="iosxml" column="iosxml" dbType="VarChar"/>
    </parameterMap>   
  </parameterMaps>

The name of the stored procedure is SP_InsertIOs which is expecting a string called "iosxml" which is passed in a hashtable(the key name is also iosxml). I use it to insert 10000 entities in the database and it works fine. If i use it to insert 50000 entities i get a timeout SqlException. How can 开发者_运维技巧i set a timeout for the procedure? I tried procedure id="InsertIOs" timeout="200" but with no result


We can add the Connection Timeout either in xml configuration or web.config.

  • In xml by using defaultStatementTimeout.
  • In web.config add Connection Timeout = 200 in the Connection String.

An example of the settings element fully configured in xmlis as follows:

<settings>
  <setting name="cacheEnabled" value="true"/>
  <setting name="lazyLoadingEnabled" value="true"/>
  <setting name="multipleResultSetsEnabled" value="true"/>
  <setting name="useColumnLabel" value="true"/>
  <setting name="useGeneratedKeys" value="false"/>
  <setting name="autoMappingBehavior" value="PARTIAL"/>
  <setting name="defaultExecutorType" value="SIMPLE"/>
  <setting name="defaultStatementTimeout" value="25"/>
  <setting name="safeRowBoundsEnabled" value="false"/>
  <setting name="mapUnderscoreToCamelCase" value="false"/>
  <setting name="localCacheScope" value="SESSION"/>
  <setting name="jdbcTypeForNull" value="OTHER"/>
  <setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/>
</settings>

An Example for web.config

<connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="ConnectionString" 
         connectionString="Data Source=;
             Initial Catalog=;
             Persist Security Info=True;
             User ID=sa;
             Password=sa@123;
             Connect Timeout=200"
             ProviderName="System.Data.SqlClient"/>
</connectionStrings>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜