Not sure why you're experiencing this issue but I can reccomend that you eliminate some of the moving parts.
Calling an LS agent that uses ODBC is not going to perform well for anything other than very minor queries.
My recommendation would be to either use the JDBC connection components from the Extension Library on Open NTF or simply use a Pure Java JDBC implementation to make the connection.