Hi
<div><br></div><div>I&#39;m having issues with HDBC when connecting to a remote MySQL server - certain queries cause the DB connection to be lost. The following program demonstrates this:</div><div><br></div><div><div>import Database.HDBC</div>

<div>import Database.HDBC.ODBC</div><div>main = do</div><div>        conn &lt;- connectODBC &quot;DSN=owlro&quot;</div><div>        putStrLn &quot;Connected&quot;</div><div>        quickQuery&#39; conn &quot;SELECT time, power FROM Power LIMIT 100;&quot; []</div>

<div>        putStrLn &quot;Finished query 1&quot;</div><div>        quickQuery&#39; conn &quot;SELECT time, power FROM Power ORDER BY time;&quot; []</div><div>        putStrLn &quot;Finished query 2&quot;</div><div>        disconnect conn</div>

</div><div><br></div><div>The DSN points to a remote 32-bit Ubuntu 12.04 Server. The connection and queries work using mysql and isql on the command line, and the table in question contains about 1.3 million rows and only the columns id, time, power.</div>

<div><br></div><div>When I compile and run this on a 64-bit Ubuntu 12.04 PC using HDBC-2.3.1.1 and HDBC-odbc-2.3.1.0 using GHC, I get the following (unwanted) output:</div><div>$ ghc Test.hs</div><div>$ ./Test</div><div>
<div>
Connected</div><div>Finished query 1</div><div>Test: SqlError {seState = &quot;[\&quot;08S01\&quot;]&quot;, seNativeError = -1, seErrorMsg = &quot;execute execute: [\&quot;2013: [MySQL][ODBC 5.1 Driver][mysqld-5.5.24-0ubuntu0.12.04.1]Lost connection to MySQL server during query\&quot;]&quot;}</div>

</div><div><br></div><div>This program finishes (and fails) in less than half a second.</div><div><br></div><div>When I run it using runhaskell however, the slow second query completes:</div><div>$ runhaskell Test.hs</div>

<div>Connected</div><div>Finished query 1</div><div>Finished query 2</div><div><br></div><div>I get the same result from ghci; this method takes about 10 seconds as expected.</div><div><br></div><div>Basically, simple (short) queries complete, yet long ones crash the connection. I also noticed similar results with HDBC-mysql.</div>

<div>Any ideas on what is causing this?</div><div>Thanks,</div><div>Will Shackleton</div><div><a href="http://digitalsquid.co.uk">digitalsquid.co.uk</a></div>