0

I am quite puzzled by the following situation: a colleague and I both use Mac OS X. I use 10.15.3, python 2.7.15, GCC 4.2.1, cx_Oracle 7.0.0 with the SQL Developer 19.1.0. She uses 10.14.6, python 2.7.10, GCC 4.2.1, cx_Oracle 7.3.0 with the SQL Developer 18.3.0.

We have a simple python script that connects to a data base via cx_Oracle. We got the usual DPI-1047 error. I followed the instructions here https://oracle.github.io/odpi/doc/installation.html#macos and with the latest 19 "Basic" version, and a bit of tweaking because of the notarization (https://github.com/oracle/python-cx_Oracle/issues/341#issuecomment-541794557) I could make it work: the .dylib files are properly picked up and the code can connect to the db.

For my colleague, the file cannot be found. We followed the exact same steps as for my computer, downloaded first the 19 then the 18 "Basic" version (naively thinking it would be related to the SQL Developer version), unzipped, and added the link to the $LD_LIBRARY_PATH variable. However, the DPI-1047 error remains to pop up.

We tried to follow previous solutions in this or other forums, but they wouldn't apply or work for us:

Thank you for your help! c.

Christopher Jones
  • 9,449
  • 3
  • 24
  • 48
conni
  • 67
  • 6
  • If you're OK upgrading to Python 3, then use cx_Oracle 8 which has a new `init_oracle_client()` function that you can pass the Instant Client directory to. See https://stackoverflow.com/a/62587663/4799035 – Christopher Jones Jun 27 '20 at 04:46

1 Answers1

1

In summary you have an issue on the 10.14.6 (Mojave) computer.

My initial thought was that you are using the OS default Python. This won't work because Apple has locked it down. From the install instructions: "Make sure you are not using the bundled Python. This has restricted entitlements and will fail to load Oracle client libraries." (I have not/cannot venture into hacking Instant Client to see if it can be made to work)

However, where did Python 2.7.10 come from? My system default is Python 2.7.16.

Don't set LD_LIBRARY_PATH. Instead my ~/lib directory has just one symbolic link:

libclntsh.dylib -> /Users/cjones/instantclient_19_3/libclntsh.dylib

All the configuration issues are due to Apple's ever tightening security requirements. Hopefully the next Oracle Instant Client release will make it easier to use.

SQL Developer is almost completely unrelated to Python cx_Oracle usage (unless you use thick-JDBC connections in SQL Developer, which is rare).

And don't follow Linux or Windows instructions on macOS!

Christopher Jones
  • 9,449
  • 3
  • 24
  • 48
  • Thank you Christopher for this response, I'll forward it to my colleague. Hope it truly will resolve the issue. – conni May 07 '20 at 14:39