mysql timeout expired处理

一、发现问题

二、分析问题

.net长时间连接mysql导致超时;

方式一:连接用完后,就关闭连接

方式二:增加C#的执行sqlcommand时间

三、解决问题

增加了这一句,问题解决了

using (MySqlConnection conn = new MySqlConnection(mysqlCon.ConnectionString))
{
    mysqlDa.SelectCommand.Connection = conn;
    //0表上永久,默认是30
    mysqlDa.SelectCommand.CommandTimeout = 0;
    conn.Open();

    MySqlTransaction tran = conn.BeginTransaction();
    mysqlDa.SelectCommand.Transaction = tran;
    mysqlDa.Fill(ds, "sp_AllInsert");
    tran.Commit();

    string returnStr = return_str.Value.ToString();
    tbCompanyID.Text = returnStr;
    MessageBox.Show(returnStr);
}
时间: 2024-08-06 19:59:22

mysql timeout expired处理的相关文章

Timeout expired 超时时间已到. 达到了最大池大小 错误及Max Pool Size设置

参考数据库链接串: <add key="data" value="server=192.168.1.123; Port=3306; uid=root; pwd=root;database=data;pooling=true;min pool size=5;max pool size=512;connect timeout = 20; "/> 查看应用程序池占用数量: select * from sysprocesses where dbid= db_id

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.【转】

今天碰到了一个查询异常问题,上网查了一下,感谢原创和译者 如果你使用的数据库连接类是 the Data Access Application Blocks "SqlHelper" 或者 SqlClient Class , 你在执行一个很费时的SQL 操作时候,可能就会碰到下面的超时异常. --------------------------- ---------------------------Timeout expired.  The timeout period elapsed

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

今天碰到了一个查询异常问题,上网查了一下,感谢原创和译者 如果你使用的数据库连接类是 the Data Access Application Blocks "SqlHelper" 或者 SqlClient Class , 你在执行一个很费时的SQL 操作时候,可能就会碰到下面的超时异常. --------------------------- ---------------------------Timeout expired.  The timeout period elapsed

mysql timeout知多少

mysql timeout知多少 ------by石锅拌饭 1.timeout变量知多少 打开mysql,用show variables like '%timeout%'命令一看,不看不知道,一看吓一跳,结果如下面所示,这么多timeout相关变量,一下就吓尿了..原来对mysql的了解原来是如此的不够,好了,这么些timeout究竟各自是什么意思,花了一下午去学习,做了几个小实验,总算明白了一二,如有错误,请不吝赐教啊. mysql> show variables like '%timeout

SSRS 2008 R2 错误:Timeout expired. The timeout period

今天遇到了Reporting Services(SQL SERVER 2008 R2)的报表执行异常情况,报表加载数据很长时间都没有响应,最后报"An error occurred within the report server database.  This may be due to a connection failure, timeout or low disk condition within the database.;".检查C:\Program Files\Micro

Oracle中的ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

向某个数据库用户中插入.更新.删除一个表的数据,或是增加一个表的主键.索引时,出现下面的错误: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired 这是因为有事务正在进行或是事务已经被锁,因此导致不成功 1)用dba权限的用户查询数据库中有哪些锁 select t2.username,t2.sid,t2.serial#,t2.logon_time from v$locked_object t1

mysql timeout

(待更新整理) 因为最近遇到一些超时的问题,正好就把所有的timeout参数都理一遍,首先数据库里查一下看有哪些超时: [email protected] : test 12:55:50> show global variables like "%timeout%"; +----------------------------+--------+ | Variable_name | Value | +----------------------------+--------+ |

mysql timeout connection

由于使用阿里云服务器,使用mysql 每当周一的时候客户端首次连,总是报timeout connection 的错误 ,尝试了几个方法没有实际效果. 1.用网上说的URl上缀上autoReconnect=true    jdbc:mysql://localhost:3306/oa?autoReconnect=true. 2.编辑mysql目录里的:my.cnf(windows下为my.ini), # The TCP/IP Port the MySQL Server will listen on 

[bug]Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

写在前面 在mysql中这个异常是非常常见的,超时分为连接超时和执行超时,而连接超时,大部分原因是网络问题,或客户端到服务端的端口问题造成. bug场景 有的时候,使用MySqlDataReader在读取数据的时候,datareader的特性是在在线读取,而且是一条一条往下读,也就是只进式读取.如果数据非常多,就会造成超时的问题. 这种超时是执行超时引起的. SqlCommand.CommandTimeout 获取或设置在终止执行命令的尝试并生成错误之前的等待时间. 等待命令执行的时间(以秒为单