The first two hsql db statements work successfully however when we query a third statement the code gives an error saying it can not detect the database for that query. The database is connected and it will only allow two queries. Each statement is individually closed as you can see in the code. Any solutions so we are able to have as many queries as we need? Below are the queries that are being run. Is anyone familiar with the amount of queries allowed in HSQLDB? Thanks in advance.
cp = "SELECT \"E_ID\" FROM \"nameable\" WHERE \"dtype\" = 'GasTurbine'";
detect = detectOdbcFailure(SQLExecDirect(stmt, (SQLCHAR*)cp.c_str(), SQL_NTS), conn,
"Non-parameter query failed");
if (detect) return detect;
detect = detectOdbcFailure(
SQLBindCol(stmt, 1, SQL_C_SLONG, &e_id, 0, NULL), conn,
"Bind of 'E_ID' output failed");
if (detect) return detect;
while ((odbcret = SQLFetch(stmt)) != SQL_NO_DATA) {
if (detectOdbcFailure(odbcret, conn, "Fetch failed")) return detect;
printf("%d\n", e_id);
}
detect = detectOdbcFailure(SQLCloseCursor(stmt), conn,
"Failed to close Cursor for re-use");
if (detect) return detect;
cp = "SELECT \"E_ID\" FROM \"nameable\" WHERE \"E_CONTAINER\" = " + std::to_string(e_id);
detect = detectOdbcFailure(SQLExecDirect(stmt, (SQLCHAR*)cp.c_str(), SQL_NTS), conn,
"Non-parameter query failed");
if (detect) return detect;
detect = detectOdbcFailure(
SQLBindCol(stmt, 1, SQL_C_SLONG, &e_id, 0, NULL), conn,
"Bind of 'E_ID' output failed");
if (detect) return detect;
while ((odbcret = SQLFetch(stmt)) != SQL_NO_DATA) {
if (detectOdbcFailure(odbcret, conn, "Fetch failed")) return detect;
printf("%d\n", e_id);
}
detect = detectOdbcFailure(SQLCloseCursor(stmt), conn,
"Failed to close Cursor for re-use");
if (detect) return detect;
cp = "SELECT \"E_ID\" FROM \"nameable\" WHERE \"dtype\" = 'Inlet'";
detect = detectOdbcFailure(SQLExecDirect(stmt, (SQLCHAR*)cp.c_str(), SQL_NTS), conn,
"Third query failed");
if (detect) return detect;
detect = detectOdbcFailure(
SQLBindCol(stmt, 1, SQL_C_SLONG, &e_id, 0, NULL), conn,
"Bind of 'E_ID' output failed");
if (detect) return detect;
while ((odbcret = SQLFetch(stmt)) != SQL_NO_DATA) {
if (detectOdbcFailure(odbcret, conn, "Fetch failed")) return detect;
printf("%d\n", e_id);
}
detect = detectOdbcFailure(SQLCloseCursor(stmt), conn,
"Failed to close Cursor for re-use");
if (detect) return detect;
}
What I have tried:
I tried closing each individual statement as well as looking through all the .config files. I combed through the HSQL DB user guide as well.