Skip to content
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

Exception: Prelude.chr: bad argument: 5046345 #28

Open
TikhonJelvis opened this issue Nov 1, 2016 · 5 comments
Open

Exception: Prelude.chr: bad argument: 5046345 #28

TikhonJelvis opened this issue Nov 1, 2016 · 5 comments

Comments

@TikhonJelvis
Copy link

I'm consistently getting the following exception when running code talking to Hive through ODBC both from a binary and from GHCi:

*** Exception: Prelude.chr: bad argument: 5046345

On a different system, we got the same exception with a different number:

*** Exception: Prelude.chr: bad argument: 5832776

This is on GHC 8.0.1 on OS X with the latest version of HDBC and HDBC-odbc. The problem comes up at some initial part of the connection process because I get the exception even if I don't have the ODBC drivers installed or a DSN entry—it's not even trying to connect.

Here's the smallest example that causes the error. (It doesn't work with a correctly configured database either.):

main = connectODBC ""

Here's a stack trace:

ghc-iserv-prof: Prelude.chr: bad argument: 5046345
CallStack (from -prof):
  Database.HDBC.ODBC.Api.Errors.raiseError (Database/HDBC/ODBC/Api/Errors.hs:(22,1)-(33,61))
  Database.HDBC.ODBC.Api.Errors.checkError (Database/HDBC/ODBC/Api/Errors.hs:(18,1)-(19,50))
  Control.Concurrent.ReadWriteLock.withRead (Control/Concurrent/ReadWriteLock.hs:222:1-50)
  Control.Concurrent.ReadWriteVar.with (Control/Concurrent/ReadWriteVar.hs:118:1-58)
  Database.HDBC.ODBC.Wrappers.withMaybeDbc (Database/HDBC/ODBC/Wrappers.hs:120:1-36)
  Database.HDBC.ODBC.Wrappers.withDbcOrDie (Database/HDBC/ODBC/Wrappers.hs:(123,1)-(132,9))
  Database.HDBC.ODBC.Connection.connectODBC (Database/HDBC/ODBC/Connection.hsc:(77,1)-(92,17))
ghc: ghc-iserv terminated (1)
Leaving GHCi.
@TikhonJelvis TikhonJelvis changed the title Exception: Prelude.chr: bad argument: 5832776 Exception: Prelude.chr: bad argument: 5046345 Nov 1, 2016
@dmvianna
Copy link

I got the same. Tested with GHC 8.0.1 and 7.10.3.

@codygman
Copy link

I got the same using the included stack.yaml and the hdbc-odbc repo as of 00edd61 by following the example in the Readme to test hdbc-odbc using sqlite3.

resolver: lts-3.17
extra-deps:
  - HDBC-2.4.0.1

System info:

unixodbc-dev version: 2.3.1-4.1

@codygman
Copy link

@TikhonJelvis and @dmvianna I fixed this by ensuring I had DSN= prepending the DSN name.

λ> connectODBC
connectODBC :: String -> IO Connection
λ> conn <- connectODBC "testsqlite3"
*** Exception: SqlError {seState = "[\"*** Exception: Prelude.chr: bad argument: 5046345
λ> conn <- connectODBC "DSN=testsqlite3"
λ>  hdbcDriverName conn
"odbc"

@igrep
Copy link
Contributor

igrep commented Dec 13, 2016

Same with #25 ?
And can you avoid it by #25 (comment)

@codygman
Copy link

@igrep It didn't work for me:

λ> odbcTest
*** Exception: SqlError {seState = "[\"08001\",\"01000\"]", seNativeError = -1, seErrorMsg = "connectODBC/sqlDriverConnect: [\"0: [unixODBC][FreeTDS][SQL Server]Unable to connect to data source\",\"20002: [unixODBC][FreeTDS][SQL Server]Adaptive Server connection failed\"]"}

The error I got could be from other things though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants