I am trying to connect to a Sybase database using hdbc-odbc via unixODBC and freetds. The following lines should be expected to open a connection, prepare a query on it, execute it and disconnect.
conn <- connectODBC connectionString
statement <- prepare conn $ queryString query
execute statement []
dataSet <- fetchAllRowsMap' statement
disconnect conn
return dataSet
The result is, however SqlError {seState = "[]", seNativeError = -2, seErrorMsg = "SQLRowCount: []"}
Yet the following code works:
conn <- connectODBC connectionString
statement <- prepare conn $ queryString query
execute statement []
dataSet <- trace "Test" seq conn fetchAllRowsMap' statement
disconnect conn
return dataSet
Importantly, neither adding seq conn
alone nor adding trace "Test"
alone will help. At the moment, the result will be the same as it was without any of them, but yesterday leaving out trace "Test"
still would result in one of two subsequent queries being succesful, with the other one yielding the same error as above. But what remained stable was the first code fragment above not working and the second one working.
Using PHP or isql, I experience no problems of that kind, which seems to show that the problem is at least in part on the side of HDBC. Also, that a use of trace
can systematically make a difference between getting results and not getting them should definitely be undesired behaviour.
Is anyone familiar with this kind of problem or does have a hunch what the cause might be? Searching the web and SO so far has been no help at all.