我正在运行Matlab的几个SQL脚本。在过去的几个月里,没有任何问题。但是,从本周开始,我开始收到以下错误:
使用database.jdbc.connection / exec时出错(第53行)[Microsoft] [ODBC SQL Server驱动程序]连接忙于另一个hstmt的结果
我已经在Matlab上正确安装了我的ODBC驱动程序,并按如下方式运行SQL查询:
% connect
conn = database('connectionName','user','password');
% I actually alter between two queries, but put the same here as an example
for i=1:2
querynew = "SELECT * FROM tbl";
results = exec(conn, querynew); % the error is triggered here
results = fetch(results);
Data = results.Data;
end
close(conn)
答案 0 :(得分:1)
尝试使用close(results)
:
for i=1:2
querynew = "SELECT * FROM tbl";
results = exec(conn, querynew); % the error is triggered here
results = fetch(results);
Data = results.Data;
close(results);
end
https://ch.mathworks.com/help/database/ug/close.html?requestedDomain=true