-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MS SQL connection fails using GHC but not GHCi #17
Comments
Interesting. Ok, try as a workaround, running your app inside a |
@jnschaeffer Did you ever find a solution that worked? I'm running into the same problem and would be thrilled with a viable workaround. |
I found a workaround using This is sufficient to prevent the connection error, but I'm not sure it's the minimal fix. I'm also unsatisfied with my understanding why this fixes the problem, and I'm hesitant to use it considering the note on appropriate use for So, if anyone has a better fix, I'd be glad to hear it. |
@lseppala That's basically what I did. In my case, I decided to use main :: IO ()
main = do
a1 <- async main_
wait a1 The actual logic for the program resides in I'd recommend using |
I've figured out the root cause for this error. I'm documenting here for my own satisfaction and for anyone else who comes across this hair-pulling issue. The I proved this 'SIGVTALRM' hypothesis by compiling with Interestingly, it seems that this bug is pretty transient. Running an unfixed binary with Bryan O'Sullivan has a blog post about an identical issue with a MySQL library. I've dug in a little bit to FreeTDS (what a bear!) to see if I could identify the exact bug, but I doubt I'll get very far. Perhaps a patch like Bryan's would do for now, but a) it's not platform independent, and b) this project doesn't seem to be accepting pull requests (at least recently). |
I'm attempting to connect to a MS SQL Server database over a VPN using hdbc-odbc. Everything works fine when run in ghci, or through runhaskell. However, compiling a program in ghc and running it produces the following error upon calling connectODBC:
Looking around it appears that the error itself means the program is failing to connect at all to the SQL server, at least according to the FreeTDS user guide: http://www.freetds.org/userguide/confirminstall.htm
I tried connecting to the server using ODBC in C and it worked, and through tsql and isql as well. I wasn't able to check the tests in hdbc-odbc/testsrc as they just returned an error:
I'm not sure what's wrong, but given that the connection works in GHCi, tsql, and in hand-written C code my guess is it has something to do with FFI and the point at which connectODBC actually talks to the ODBC API.
As a side note, I've tested this against hdbc-odbc 2.3.1.1 and 2.3.1.0, and both have the same issue. Connecting to SQLite works as well.
Update: Using ghci with
-fno-ghci-sandbox
also causes the connection to fail. Not sure why.The text was updated successfully, but these errors were encountered: