I told you already that it may be timing issues. Unfortunately I do know nothing about odbc. I just tested if I can import it, but I can not. And nimble search odbc seems to find it not.
Timing issues can occur when threading or async is active. Debugging is generally testing for things for which you strongly assume that they are OK. You can split complex statements into simpler ones and print all the values with echo. Have you tried the "nim -d:release --stackTrace:on --lineTrace:on" suggestion from Mr jrfondren above? Well maybe you will find someone who will do the debugging for you. For me unfortunately that never works, I have to do it myself always. In a few forums using a nice female user name helps, but I never tried that. :-)