Menu

CommandTimeout

2004-09-28
2013-04-17
  • Chris Tinsley

    Chris Tinsley - 2004-09-28

    First of all, Thanks for the tool.  I'm finding it very useful for automated builds and rollout scripts.  However, I have some scripts that migrate data occasionally.  I have run into a scenario where I have a data migration that takes almost 45 minutes.  SqlRunner is not setting the commandTimeout before it runs the script, and therefore times out after 30 seconds.

    I have modified:
            public void Execute( string sqlString )
            {
                SqlCommand cmd = new SqlCommand( sqlString, _connection );
                cmd.ExecuteNonQuery();
            }

    to:

            public void Execute( string sqlString )
            {
                SqlCommand cmd = new SqlCommand( sqlString, _connection );
                cmd.CommandTimeout=0;
                cmd.ExecuteNonQuery();
            }

    This gives the script an indefinite amount of time to execute.  Ideally, I think another parameter for timeout would be handy, but my hack is working for me now.

    Thanks,
    Chris

     
    • Graham Tackley

      Graham Tackley - 2004-10-04

      Chris,

      That's a really good point.  All of the scripts I'm running at the moment are very short so I haven't hit that problem.

      I've applied your change to the code, and I'll post an issue to add a parameter in the future.

      Cheers,
      Graham

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.