0

I was wondering how you are supposed to connect to an oracle db on mac with Haskell HDBC.

I tried doing it through ODBC, by running brew install unixobcd and then installing oracle instant client basic and obdc into a directory. Then in Haskell, with HDBC and HDBC-odbc both installed, calling connectODBC with Driver set to the location of libsqora.dylib.12.1 in said directory.

It is giving me sot-dba: SqlError {seState = "[\"01000\"]", seNativeError = -1, seErrorMsg = "connectODBC/sqlDriverConnect: [\"0: [unixODBC][Driver Manager]Can't open lib '<valid absolute path to libsqora.dylib.12.1>' : file not found\"]"}, but when I cat that location it spills out the appropriate unreadably binary, so its definitely a valid file location.

I was wondering if anyone could either help debug my issue, or just give me instructions on how to set it up from scratch and I will happily do it over properly. I just have no idea where to go from here since it is claiming a file doesn't exist that does, and I am having trouble finding many results on google on how to debug that.

One thing perhaps worth noting is that I ran ./odbc_update_ini.sh /usr/local/Cellar/unixodbc/2.3.4 to set up the oracle odbc driver, because that is the location that brew put unixodbc, was that perhaps incorrect?

If necessary I could consider a different library than HDBC, but I would strongly prefer not having to, it seems like some other libraries such as persistent actually use hdbc/hdbc-odbc under the covers anyway, so surely this shouldn't be hard.

semicolon
  • 2,530
  • 27
  • 37
  • Does a tool like `isql` work for you with this driver? – Arnon Jul 05 '17 at 20:25
  • @Arnon How do I connect `isql` to an oracle db? When I google it I just get a huge amount of isql\*plus and sql\*plus noise instead of an answer. – semicolon Jul 05 '17 at 21:13
  • Well, you want to test that unixOdbc actually functions and your DSN/driver is correct. Single out unixOdbc before attempting the Haskell bit.... This man-page has some samples https://www.mankier.com/1/isql – Arnon Jul 05 '17 at 21:37
  • I looked at the man page but I don't see how to pass in the connection string, so things like the driver, the server protocol / host / port and the service name. – semicolon Jul 05 '17 at 21:42
  • You define the parameters like user/port/etc... in the DSN settings... https://oracle-base.com/articles/linux/create-an-odbc-dsn-on-linux – Arnon Jul 05 '17 at 21:45
  • @Arnon Ok `isql ` works fine now, but `connectODBC "DSN="` is still giving me `[unixODBC][Driver Manager]Can't open lib ' : file not found`. – semicolon Jul 07 '17 at 15:53
  • Do you have Instant Client in ~/lib ? See the Instant Client installation instructions for details: http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html#ic_osx_inst – Christopher Jones Jul 09 '17 at 07:25
  • That fixed it, thanks! – semicolon Jul 10 '17 at 15:50

0 Answers0