Hi, i have been getting this recurring error on a project using Erlaang ODBC for SQL Server.
Started when I updated the connection string from:
"DRIVER={ODBC Driver 17 for SQL Server};Server=..."
to
"DRIVER={SQL Server};Server=..."
The second version is the only one i’ve got to work correctly with queries involving VARCHAR(MAX)
like SELECT 'Bob' [name], 50 [age] FOR JSON PATH;
for example.
Everything seems to work fine for several hours, then begins to fail after a while with:
%MatchError{
term: {:error,
{{:badmatch, {:error, :system_limit}},
[
{:odbc, :init, 1, [file: 'odbc.erl', line: 445]},
{:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 417]},
{:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 385]},
{:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}
]}}
My calling code is:
def connect() do
{server, port, db, uid, pwd} = {host_instance(), @opt[:port], @opt[:database], @opt[:username], @opt[:password]}
conn = "DRIVER={SQL Server};Server=#{server};PORT=#{port};DATABASE=#{db};UID=#{uid};PWD=#{pwd};"
{:ok, pid} =
:odbc.connect(
to_charlist(conn),
timeout: 30_000,
# auto_commit: true,
binary_strings: :on,
tuple_row: :off,
# scrollable_cursors: :off,
extended_errors: :on
)
pid
end