PERL DBI 自动重连问题
来源:互联网 发布:淘宝哪个男装店好 编辑:程序博客网 时间:2024/05/17 07:10
[root@wx03 mojo]# cat relink.pl use Mojolicious::Lite;use JSON qw/encode_json decode_json/;use Encode;no strict;no warnings;use JSON;use POSIX;use JSON::RPC::Client;use Data::Dumper;use DBI;# /foo?user=sri`my %hash=();my $dbUser='DEVOPS';my $user="root";my $passwd="R00t,uHagt.xx";my $dbh = DBI->connect("dbi:mysql:database=$dbUser;host=127.0.0.1;port=3306",$user,$passwd) or die "can't connect to database ". DBI-errstr;get '/api/relink' => sub{ my $c = shift; my @arr2=(); my $env = $c->param('env'); my $hostSql = qq{select ip,info,env from publish_info where env='$env';};my ($a1, $a2, $a3,$a4,$a5,$a6,$a7,$a8,$a9);my $selStmt = $dbh->prepare($hostSql);$selStmt->execute();$selStmt->bind_columns(undef, \$a1, \$a2,\$a3);while( $selStmt->fetch() ){print "\$a1 is $a1\n";print "\$a2 is $a2\n";print "\$a3 is $a3\n";push (@arr2, "$a1 $a2 $a3" ); }; $c->render(json => \@arr2);};app->start;[root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test["1.1.1.1 aa test"]停止数据库,启动数据库[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# curl http://127.0.0.1:3000/api/relink?env=test[][root@wx03 ~]# 代码报错:Server available at http://127.0.0.1:3000$a1 is 1.1.1.1$a2 is aa$a3 is test$a1 is 1.1.1.1$a2 is aa$a3 is testDBD::mysql::st execute failed: Lost connection to MySQL server during query at /root/mojo/relink.pl line 25.DBD::mysql::st bind_columns failed: Statement has no result columns to bind (perhaps you need to successfully call execute first, or again) at /root/mojo/relink.pl line 26.DBD::mysql::st fetch failed: fetch() without execute() at /root/mojo/relink.pl line 27.DBD::mysql::st execute failed: MySQL server has gone away at /root/mojo/relink.pl line 25.DBD::mysql::st bind_columns failed: Statement has no result columns to bind (perhaps you need to successfully call execute first, or again) at /root/mojo/relink.pl line 26.DBD::mysql::st fetch failed: fetch() without execute() at /root/mojo/relink.pl line 27.没有自动重连
0 0
- PERL DBI 自动重连问题
- Perl DBI
- perl DBI
- Perl DBI连接Sql Server问题
- 自动重连
- asmack自动重连
- mysql 自动重连
- 数据库自动重连
- TCP自动重连
- Perl DBI 自动选择更新部分字段的值
- PHP PDO 自动重连
- activeMQ 自动重连机制
- hibernate 断开自动重连
- dbcp自动重连机制
- 夜神自动重连
- 安装perl和DBI-mysql出现的一些问题
- Perl Tk和DBI结合 软件匹配问题
- Perl DBI实例
- 怎么制作区块链
- JSP基础语法
- JAVA内存模型
- yii2的curd
- jmeter对oracle压力测试
- PERL DBI 自动重连问题
- Top K Frequent Elements——出现频次最多的k个数
- 有向无环图DAG上的动态规划
- C#设计模式之策略模式(Strategy Pattern)
- phpstorm配置代码自动同步到服务器(2016.10.7)
- c#播放flash动画
- php中的错误级别
- 模拟QQ登录界面
- 如何制作区块链