webman 重启thinkorm会报错误

hzniubi

问题描述

每次重启都会有这个问题,报了一段时间就没有了,我安装了laravel的数据库和thinkorm

程序代码

database.php 没有配置
thinkorm 里面有多个连接,mysql 和 sqlserver的

报错信息

/vendor/topthink/think-orm/src/db/PDOConnection.php:1499:SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]New transaction is not allowed because there are other threads running in the session.
320 1 0
1个回答

walkor

看起来是有的请求没提交或回滚事务。检查下哪里用了事务没提交。
事务的标准用法

try {
  // 开启事务
  // 业务逻辑
  // 提交事务
} catch (\Throwable $e) { // 注意使用\Throwable $e,如果用Excpetion $e则无法捕获Error
   回滚事务
}
🔝