2010-07-14 74 views
2

我有这个过程语句IBATIS - 存储过程超时

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

</statements> 

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

存储过程是SP_InsertIOs被期待称为其在哈希表通过“iosxml”字符串的名称(键名也iosxml )。 我用它在数据库中插入10000个实体,它工作正常。如果我用它来插入 50000实体,我得到一个超时SqlException。我如何设置过程的超时时间? 我尝试过程ID =“InsertIOs”超时=“200”,但没有结果

+2

问题的一个实施例解决了,我连接字符串中加入连接超时= 120 。 – ion 2010-07-14 07:01:42

回答

0

我们可以添加Connection Timeout无论是在xml configurationweb.config

  • xml通过使用defaultStatementTimeout
  • web.config在连接字符串中添加Connection Timeout = 200

xml完全配置的设置元件的一个例子是如下:

<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> 

web.config

<connectionStrings> 
    <remove name="LocalSqlServer"/> 
    <add name="ConnectionString" 
     connectionString="Data Source=; 
      Initial Catalog=; 
      Persist Security Info=True; 
      User ID=sa; 
      [email protected]; 
      Connect Timeout=200" 
      ProviderName="System.Data.SqlClient"/> 
</connectionStrings>