JZTXT
  • 首页
  • Ai
  • Java
  • Python
  • Android
  • Mysql
  • JavaScript
  • Html
  • CSS

gorm 出现报错 "invalid connection"

发布时间 2023-06-16 20:31:41作者: 李若盛开

看到 wait_timeout = 28800 ,也就是8小时,那么一个8小时内没有数据库操作的话,数据库就会关闭连接。

 

db.DB().SetConnMaxLifetime(time.Hour*4)      //括号里面是超时时间,要小于数据库的超时时间

 

    本栏目推荐文章
  • Gorm 关联关系介绍与基本使用
  • A connection was successfully established with the server but then an error
  • vscode错误:Unable to connect to VS Code server: Error in request.
  • 【Leetcode1949. 坚定的友谊】使用MySQL在无向图中寻找{"CompleteTripartite", {1, 1, 3}}这个pattern
  • Python中出现"No module named 'requests'"的图文解决办法
  • 在Windows上出现"localhost拒绝连接”的问题
  • "nginx.conf" E514 : write error (file system full?)
  • 加了@SessionAttributes("uid")退出登陆后如何清除session
  • scp 出现 subsystem request failed on channel 0 scp: Connection closed 的解决方法
  • Gorm实战,轻松掌握数据库增删改查技巧!
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们