Hi there,
I wrote an application using libzdb, which works fine when I connect directly to a MySQL server.
But when I connect to ProxySQL I get this error when doing a Connection_executeQuery():
SQLException: Commands out of sync; you can't run this command now
raised in Connection_executeQuery at src/db/Connection.c:335
It's a very basic select: "SELECT * FROM instance".
When I do the same with libmysql (acutally it's libmariadb), there's no issue.
This is the test code:
#include <stdio.h>
#include <zdb.h>
main() {
URL_T url = URL_new("mysql://sbuser:sbpass@127.0.0.1:6033/cpr_db");
ConnectionPool_T pool = ConnectionPool_new(url);
ConnectionPool_start(pool);
Connection_T con = ConnectionPool_getConnection(pool);
ResultSet_T result = Connection_executeQuery(con, "SELECT * FROM instance");
while (ResultSet_next(result))
{
int id = ResultSet_getInt(result, 1);
printf("%d\n", id);
}
Connection_close(con);
ConnectionPool_free(&pool);
URL_free(&url);
}
Any idea what is the issue here?
Cheers
Till