I have configured the Oracle client and try with the below code, But error prompted from the code.
import os
os.chdir("C:\\oreclient_install_dir\\instantclient_12_2")
import cx_Oracle
ORACLE_CONNECT = "user/pass#(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SID=sid)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
print("Connected to Oracle: " + orcl.version)
Error :
Python.exe - Entry Point Not Found
The Procedure entry point K32GetModuleBaseNameA could not be located in the dynamic link library KERNEL32.dll
I am using Server 2008 32 bit as client machine and remotely connect to Oracle Data Base 12c Enterprise Edition Release 12.2.0.1.0 - 64bit
Tried both Python 2.7 and 3.6.
Instant client version is "instantclient_12_2"
Appreciate if you can give me a feedback on this.
Thanks,
Tharindu Panagoda
Related
I am connecting to an Oracle DB using LDAP and the Python cx_Oracle library. I have proper sqlnet.ora, ldap.ora and tnsnames.ora files. On my Windows machine everything works fine using the 12.1 Oracle client and the following Python code:
import cx_Oracle
connection = cx_Oracle.connect(user/password#db, mode=cx_Oracle.SYSDBA)
I have installed the Oracle instant client 12.1 on my Linux machine (Debian) following the zip file installation method advised on the Oracle website (at the bottom of https://www.oracle.com/be/database/technologies/instant-client/linux-x86-64-downloads.html).
ldconfig correctly lists the oracle client libraries and their paths.
I copy the exact same sqlnet.ora, ldap.ora and tnsnames.ora files from my Windows machine to my Linux machine
in /opt/oracle/instantclient_12_1/network/admin, as advised by the cx_Oracle documentation.
Now running the above Python code on my Linux machine I have the following error:
cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect identifier specified
I tried as well setting the environment variable TNS_ADMIN=/opt/oracle/instantclient_12_1/network/admin and ORACLE_HOME=/opt/oracle/instantclient_12_1/ with no success neither
Could any of you help me debugging this and understand why the client config on my Linux machine does not work?
Installed the latest 19 client and everything works as expected.
I want to connect to local database with cx_Oracle but it throws an error:
DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "libclntsh.so: cannot open shared object file: No such file or directory". See https://oracle.github.io/odpi/doc/installation.html#linux for help
I can connect to database with sqlplus and SQL Developer, but it doesnt work with Python cx_Oracle in Jupyter.
import cx_Oracle
host = 'localhost'
port = 1521
SID = 'xe'
dsn_tns = cx_Oracle.makedsn(host, port, SID)
connection = cx_Oracle.connect('user', 'passwd', dsn_tns)
Is it possible I messed sth. with environment variables or client installation?
echo ${ORACLE_HOME};
/u01/app/oracle/product/11.2.0/xe
echo ${LD_LIBRARY_PATH};
/usr/lib/oracle/12.2/client64/lib
I installed client in /usr/lib/oracle/12.2/client64/lib
You may as well update cx_Oracle. The DPI-1047 message is using text that was updated in recent versions. This won't actually solve your problem
Keep it clean. Don't set ORACLE_HOME if you are using Oracle Instant Client.
I suspect your environment variables aren't being propagated down to cx_Oracle.
With a 64-bit XE, you shouldn't need to install Instant Client in your case (because your cx_Oracle message tells me it is 64-bit because the error is looking for a 64-bit Oracle client). cx_Oracle can use the DB libraries.
Once you sort out your library search path issue, you will then hit a problem with your connection string. You are trying to use an old SID construct, but should use a Service Name. It needs to be set like:
sn = 'xe'
dsn_tns = cx_Oracle.makedsn(host, port, service_name=sn)
The cx_Oracle documentation covers installation and also has a User Guide section that is worth reviewing https://cx-oracle.readthedocs.io/en/latest/index.html
I have been trying to connect Python 3.7.1 to TOAD 11, with a client version 10.2.
When I try running the code below
import cx_Oracle
connection = cx_Oracle.connect('myusername/mypassword#orcl')
cursor = connection.cursor()
querystring = "select * from TABLE_NAME"
cursor.execute(querystring)
I get the following error:
DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "C:\ORACLE\PRODUCT\10.2.0\CLIENT_1\bin\oci.dll is not the correct architecture". See https://oracle.github.io/odpi/doc/installation.html#windows for help
I have been trying to download a 64 bit client, but I don't understand why I need one since TOAD and it's current client are 32-bit. The issue is that with my company, it does not say the bits in the description whenever something is requested to be installed (due to the security in the network, I cannot download anything unless it is approved by the IT department, and it can only be downloaded through their server). I attempted to download the instant client 11g, but it seems it was installed but the 10.2 version it's still the only one I can find in my machine. I cannot see where it is located anywhere, so I cannot even set an environment variable for it, but I can see it in the "uninstall wizard", but it doesn't show it's location. I don't even know if 11g is 64 bit or 32 bit.
Has anybody fixed this problem before?
Is my code off and maybe that's why its not working?
The error message is saying you need a 64-bit Oracle Client because Python is 64-bit.
For cx_Oracle you need Oracle client libraries version 11.2 or later. You can get the libraries as part of Oracle Instant Client from http://www.oracle.com/technetwork/topics/winx64soft-089540.html On Windows you will also need the Redistributable noted on that download page.
Also see the cx_Oracle installation instructions at https://cx-oracle.readthedocs.io/en/latest/installation.html#installing-cx-oracle-on-windows
You will have to work with your IT people to make this happen.
I have developed a Python executable programm (with PyInstaller).
This executable use Firebird.
My computer is 64bits, so as my Python and my libraires then.
My executable works perfectly with Firebird 64bits.
The issue is that I want my executable to work on other computers that have only Firebird 32bits installed.
For now, when I try on an other computers the log tells me that (Sorry I have only the picture because my client only send me this and not the 'text' error) :
Is there a way to make it work with Firebird x32 ?
Thanks
You application need client libraries of Firebird.
[Application] <--> [Firebird client libraries] <==> (local or remote connection) <==> [Firebird client libraries] <-> [Firebird server]
If your application is Win64, then it needs Win64 client libraries of Firebird to make connection to ANY Firebird server.
So you need to distribute and install client libraries of Firebird matching your application architecture together with your app. Or you may require users to download and install client part of Firebird with the required architecture, before installing your app.
See also:
connecting to firebird server from client
https://firebirdsql.org/manual/qsg10-client-only-install.html
https://firebirdsql.org/file/documentation/reference_manuals/driver_manuals/odbc/html/fbodbc205-download-fbclient.html
https://firebirdsql.org/file/documentation/reference_manuals/user_manuals/html/qsg3-installing.html
If your app is 32bit than you need 32bit fb client dll/so to load, even on 64bit platform. You can connect on any compatible fbserver(regardless 64 or 32bit). So fb client lib(dll) issues are those you need to resolve. If you use fb as embedded library you need only one dll, and it must be compatible with your app binary interface and on 32bit system you need 32bit fbclient.dll to load. I hope this helps.
Tried to connect to the Oracle database using Pyodbc:
try:
db_connection = pyodbc.connect('DSN=OraDev; PWD=%s' % Key.dbKeys['password'])
except pyodbc.Error, err:
print >> debug_file, "Database connection failed: %s" %err
sys.exit()
and it keeps giving me this error message:
'[IM014] [Microsoft][ODBC Driver Manager] The specified DSN
contains an architecture mismatch between the Driver and Application
(0) (SQLDriverConnect)
So I am wondering if the culprit is that I am not having the "matching" components. Currently, I have:
Python 2.7 32bit
Pyodbc 3.0.6 win32-py2.7
Oracle ODBC driver: 32bit
Windows server 2008 64bit
Oracle 11.2.0 64bit
Are there anything wrong with the versions here? Thanks.
The issue you are having is that 64 bit Windows does not play well with 32 bit ODBC. You can read more about it here:
The 32-bit version of the ODBC Administrator tool and the 64-bit version of the ODBC Administrator tool display both the 32-bit user DSNs and the 64-bit user DSNs in a 64-bit version of the Windows operating system.
The work around is to specifically target the ODBC driver for the architecture you are looking to implement.
A side note, trying to implement ODBC for oracle on a mixed architecture platform became a headache for us. So, we implemented access to oracle through CX_Oracle