Connect to an Oracle database in Haskell using HDBC

I tried to work with Oracle Database from Haskell and ran into such a problem. So there is this code. Main module, where

import Database.HDBC import Database.HDBC.ODBC main :: IO () main = do let connectionString = "Driver={Microsoft ODBC for Oracle};Server=127.0.0.1;Uid=valera;Pwd=2562525;" let ioconn = connectODBC connectionString conn <- ioconn vals <- quickQuery conn "SELECT * FROM PERSONS_TEST" [] print vals return () 

Pretty simple, huh? But that will not work. There is an error with this connection string

 *** Exception: SqlError {seState = "[\"HY090\"]", seNativeError = -1, seErrorMsg = "sqlGetInfo SQL_TXN_CAPABLE: [\"0: [Microsoft][ODBC driver for Oracle]\\65533... 

and then 65333 is repeated many times. And with that

 Provider=msdaora;Data Source=127.0.0.1;User Id=valera;Password=2562525; 

error

 *** Exception: SqlError {seState = "[\"IM002\"]", seNativeError = -1, seErrorMsg = "connectODBC/sqlDriverConnect: [\"0: [Microsoft][\\65533... 

and 65333 repeats again until the end I suppose the problem is with the connection string, but I tried a whole bunch (I used http://www.connectionstrings.com/ )

I am using Haskell Platform 2011.4.0.0, GHC 7.0.4, Oracle Database XE 11.2 for Windows 7 64-bit. Installed Microsoft MDAC SDK.

+4
source share
1 answer

\ 65533 etc. are the line characters of the ODBC driver error message in your locale (RU?). I find the best development method in the English language system, so the error messages in the ghci console are displayed in English and can be read.

+2
source

Source: https://habr.com/ru/post/1395916/


All Articles