2

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

Drew
  • 29,895
  • 7
  • 74
  • 104
ion
  • 1,141
  • 3
  • 9
  • 9

1 Answers1

0

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>
09Q71AO534
  • 4,300
  • 13
  • 44
  • 68