1

Can we connect to oracle database using python in linux without "cx_Oracle" library. We have a restriction of installing "Oracle Instant client which is mandatory required for cx_oracle library" .

We are getting below error while trying to connect to oracle database using "cx_Oracle"

Error: cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle 
Client library: "libclntsh.so: cannot open shared object file: No such 
file or directory"

Please suggest if there is any way to connect to oracle without "cx_oracle" and without installing Instant client

Arya
  • 528
  • 6
  • 26
  • You should extract the libraries locally if you do not want to use the cx _oracle library. – Kostas Charitidis Aug 20 '19 at 07:50
  • @KostasCharitidis.. Thanks a lot for the reply. We are using linux server to execute this. is that possible how to extract the libraries locally ? – Arya Aug 20 '19 at 07:52
  • Take a look at this post maybe it helps. https://stackoverflow.com/questions/19142677/how-do-i-access-an-oracle-db-without-installing-oracles-client-and-cx-oracle – Kostas Charitidis Aug 20 '19 at 07:53
  • @KostasCharitidis. Yes , i have referred this post but there was no complete information and thats why i posted the question – Arya Aug 20 '19 at 07:54
  • @KostasCharitidis. If you have any page to have a reference or any suggestion. Please help me i will try each and every step from my end – Arya Aug 20 '19 at 09:32
  • 1
    Well I don't have more info to give you without using the client. But why don't you want to install the client? – Kostas Charitidis Aug 20 '19 at 09:36
  • @APC. Thanks a lot for the reply. Yes i have the library but i cant install "Instant Client". Is that possible ? If you have any reference page please help me with the link – Arya Aug 20 '19 at 09:45
  • @KostasCharitidis. We have already oracle 12.1 in our server but "cx_Oracle" searches "Instant Client" and if we install the client it may hamper existing 12.1 . – Arya Aug 20 '19 at 09:47
  • @APC. We have already oracle 12.1 in our server but "cx_Oracle" searches "Instant Client" and if we install the client it may hamper existing 12.1 – Arya Aug 20 '19 at 09:47
  • 1
    So the question you really meant to ask was, *"How do I configure cx_oracle to run with pre-existing Oracle client?"* The cx_oracle documentation shows how to do this but it rather confuses things by banging on about Instant Client all over the shop, so it is difficult to isolate what we need to do when we have an existing client. Read the section on [Local Database or Full Oracle Client (scroll down)](https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html#installing-cx-oracle-on-linux). – APC Aug 20 '19 at 10:19
  • @APC. Thanks for the link. I see we have to run the command "source /usr/local/bin/oraenv" how will that be helpful ? because there is no complete information – Arya Aug 20 '19 at 11:16
  • It sounds like cx_oracle can't find your existing Oracle installations. So I think you may need to set the ORACLE_HOME environment. Sorry but it's a long time since I did anything with cx_oracle. And even then I was just playing – APC Aug 20 '19 at 11:36
  • 1
    I think [this short article by Catherine Devlin](http://catherinedevlin.blogspot.com/2008/06/cxoracle-and-oracle-xe-on-ubuntu.html) will help you. It shows the steps for Oracle XE, but they will be the same for SE or EE. – APC Aug 20 '19 at 12:45
  • You could use JDBC instead of cx_Oracle. The dependencies for this is perhaps a bit simpler (jdbc jars and the Jpype module). For example, see https://stackoverflow.com/questions/57789704 – Niels Jespersen Jan 06 '20 at 06:27

0 Answers0