当前位置:网站首页>Wsarecv: an existing connection was forcefully closed by the remote host
Wsarecv: an existing connection was forcefully closed by the remote host
2022-06-11 10:15:00 【CSDN Q & A】
go Connection to database always disconnected remotely
func TestOpenCA(t *testing.T) { var source = "host=xx.xx.xx.xx user=xxx password=xxx dbname=xxx port=5432 sslmode=disable" //var source = "host=127.0.0.1 user=postgres password=xxx dbname=xx port=5432 sslmode=disable" db, err := sql.Open("postgres", source) if err != nil { t.Error(err) } var sql = `INSERT INTO "test" (a,b,c) VALUES("1","2","3") ,("1","2","3") ;` fmt.Println(db.Ping()) db.SetConnMaxIdleTime(10 * time.Minute) db.SetConnMaxLifetime(10 * time.Minute) var errIdx = 0 for i := 0; i < 100; i++ { _, err := db.ExecContext(context.Background(), sql) if err != nil { errIdx += 1 //t.Error(err) //return } //fmt.Println(c.LastInsertId()) } fmt.Println(errIdx) defer db.Close() fmt.Scanln()}It's the code , Local database inserts are successful , The database of the server is remotely , Always report errors wsarecv: An existing connection was forcibly closed by the remote host, The Internet should be OK ,sql Also no problem , It's just that this error is reported frequently .
边栏推荐
- Mouse click coordinate transformation generation
- parker派克先导式电磁阀和直动式电磁阀的区别有哪些?
- Record yesterday's embarrassment
- 微信小程序之点餐系统附源码
- ESP8266_ Access to the core suite of Baidu Internet of things and use mqtt protocol for communication
- Correct opening method of RPC | understand go native net/rpc package
- 本人书签常存的地址
- What hydraulic oil is used for Denison hydraulic pump? What are the requirements
- B站到底能不能赚到钱?
- Data consistency
猜你喜欢

Correct opening method of RPC | understand go native net/rpc package

Introduction to steamvr

深夜小酌,50道经典SQL题,真香~

图表背后的秘密 | 技术指标讲解:唐奇安通道

Differences between beanfactory and factorybean

不卷了!入职字节跳动一周就果断跑了。

Technology cloud report: privacy computing under the wave of Web3.0

Ugui picture wall

Empire CMS imitation "game bird" template source code /92kaifa version large mobile game portal template

Initial deployment of Servlet
随机推荐
MySQL comparison
ZigBee模块无线传输星形拓扑组网结构简介
Browserfetcher class for getting started with puppeter
General idea of interface tuning
Wechat applet ordering system with source code
WordPress website backup
Function and function of wandfluh proportional valve
科技云报道:Web3.0浪潮下的隐私计算
流式计算知识
UGUI
Differences between beanfactory and factorybean
Datagrip 2022, datagrip function
Project lifecycle
外包干了四年,废了...
选择DC-DC开关电源控制器的实战过程
利用PHP开发的一款万能、表白墙系统部分代码片段
Tree topology networking structure of ZigBee module communication protocol
What are the differences between Parker pilot solenoid valve and direct acting solenoid valve?
面试复习手写题--函数截流与抖动
Address of my bookmark