I have downloaded & installed the latest Python InformixDB package, but when I try to import it from the shell, I am getting the following error in the form of a Windows dialog box!
"A procedure entry point sqli_describe_input_stmt could not be located in the dynamic link isqlit09a.dll"
Any ideas what's happening?
Platform: Windows Vista (Biz Edition), Python 2.5.
Which version of IBM Informix Connect (I-Connect) or IBM Informix ClientSDK (CSDK) are you using? The 'describe input' function is a more recent addition, but it is likely that you have it.
Have you been able to connect to any Informix DBMS from the command shell? If not, then the suspicion must be that you don't have the correct environment. You would probably need to specify $INFORMIXDIR (or %INFORMIXDIR% - I'm going to omit '$' and '%' sigils from here on); you would need to set INFORMIXSERVER to connect successfully; you would need to have the correct directory (probably INFORMIXDIR/bin on Windows; on Unix, it would be INFORMIXDIR/lib and INFORMIXDIR/lib/esql or INFORMIXDIR/lib/odbc) on your PATH.
Does other way to connect to database work?
Can you use (configure in control panel) ODBC? If ODBC works then you can use Python win32 extensions (ActiveState distribution comes with it) and there is ODBC support. You can also use Jython which can work with ODBC via JDBC-ODBC bridge or with Informix JDBC driver.
Related
When trying to make a program on Windows that connects to a database via ODBC, I got the following error:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
I'm sure my code is right. It even worked on a different PC.
Why am I getting this error? And How do I fix it?
What causes this error?
The error message tells you, simply put, that the ODBC Driver Manager could not find the driver you specified in your connection string or DSN.
This can have 3 common causes:
The driver you tried to use is not installed on your system
The driver is installed, however, it doesn't match bitness of the code you're running
You made an error in typing the driver name
How do I check which drivers are installed on my system?
You can check the drivers which are installed on your system by going to the ODBC Data Source Administrator. To open it, press ⊞ Win + R, and type in: odbcad32.exe. Then check the tab Drivers for installed drivers. The Name column indicates the exact name you should use in your connection string or DSN.
If you're on 64-bit Windows, that only lists the 64-bit drivers installed on
your system. To see which 32-bit drivers are installed, press press ⊞ Win + R, and type in: C:\Windows\SysWOW64\odbcad32.exe, and go to the Drivers tab again.
The driver is installed, but it might be the wrong bitness, what do I do?
Then, you have two choices, either adjust the bitness your program is running in, or install a driver with a different bitness.
Some of the drivers that are installed by default on Windows only have a 32-bits variant. These can't be used with 64-bits programs.
You can usually identify which bitness a program is running under in task manager. In Windows 10, all 32-bit programs have (32-bit) appended to their name. If that isn't there, you're likely running a 64-bit program, and most modern programming languages and environments run on 64-bit by default, but allow you to switch to 32-bit. However, the specifics for different programming languages are outside the scope of this question.
How can I verify I didn't mistype the driver name?
An ODBC connection string looks like this:
DRIVER={DriverName};ParameterName1=ParameterValue1;ParameterNameN=ParameterValueN;
The driver name part needs to be delimited by curly braces if it might contain special characters, and needs to exactly match the installed driver name, as found in the ODBC Data Source Administrator, including spaces and typographical characters, but excluding capitalization.
Note that for deployed code, the driver must be present on the computer/server running the code.
I don't have the driver, or have the wrong bitness, where do I get the right one?
That depends on which driver you want to use.
A list of common drivers with download locations (all 32-bit and 64-bit at the same URL):
The Microsoft ODBC Driver 17 for SQL Server
The Microsoft Access database driver, which is part of the Microsoft Access Database Engine. Note that simultaneous installations of 32-bit and 64-bit Access ODBC drivers are not supported.
The MySQL ODBC connector by Oracle
The open-source SQLite ODBC driver by Christian Werner (non-official)
psqlODBC, the official PostgreSQL driver
If the driver you want to use isn't listed, the location is usually easily found using Google.
In design mode, a value has been set to the property of
TFDConnection.ConnectionDefName must be empty.
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:
https://github.com/oracle/python-cx_Oracle/issues/210 (with https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html#ic_x64_inst) -> the same for us except the "per step 3" part does not apply -> we do not have any .so files in the instantclient download
DPI-1047: 64-bit Oracle Client library cannot be loaded - we verified that we both use 64-bit python using python -c 'import sys;print("%x" % sys.maxsize, sys.maxsize > 2**32)', rest in this thread applies to Windows
How to fix: cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library - Python - there is no /usr/lib/oracle folder, neither for me nor for her, where one would need to set the version explicitly; in fact, the downloaded folder contains a soft link to the proper version of the .dylib already (we also played around with having it point to other .dylib versions)
Thank you for your help!
c.
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!
After trying to connect to DB with cx_Oracle.connect(...) I get the following exception: cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 32-bit Oracle Client Library: "...path" is not the correct architecture.
I am also given a link where there are some info about the libraries and about the fact that Oracle Client libraries "require the presence of the correct Visual Studio redistributable".
The thing is that the only thing I have (where I actually create the DB itself) is Oracle SqlDeveloper.
So.. do I really need to install smth to get it to work?
Your python is 32bit & looking for 32bit cx_Oracle.
You need to install Visual Studio & cx_Oracle.
Refer to this site and download the 32 bit cx_oracle .zip & the VS .exe.
Install the VS .exe (double click to install).
Unzip the cx_oracle zip, put it into your python installation folder, eg.
C:\Python\Python37-32\Lib\site-packages\
to get to this directory
C:\Python\Python37-32\Lib\site-packages\instantclient_19_3\
Set your computer/machine PATH in "environment variable" to include
C:\Python\Python37-32\Lib\site-packages\instantclient_19_3
Restart your machine.
I'm trying to connect to my work's remote DB but when I run the python script it shows this error.
I already did everything this guide says I should have as requirements but the error keeps showing. I've tried to connect through sql* and it works as it should. I downloaded oracle client libraries 12.2 (32 bits version since it needs to have the same architecture as python), I'm working with Oracle Database 11g version 11.2.0.3, Python 3.7 and I already installed Visual Studio Redistributable 2013.
This is the python script I'm using to connect to the DB. Obviously, the IP and port are different from the real one, as well as the credentials.
import cx_Oracle
host='196.0.0.0'
port='8080'
service_name='SID'
pwd= 'PASS'
dsn_tns = cx_Oracle.makedsn(host,port,service_name)
connection = cx_Oracle.connect('user',pwd,dsn_tns)
Whenever I run it, I get the error eventhough the oracle client libraries folder are already on the PATH of my computer. Do I have to configure something from the server side? Thanks for the help!
In fact, it's a version problem. I found the same problem when i used version 19. I have solved this problem when i changed the version to 12.2
I had the exact same issue and I referred to the document you linked here. I am using PyCharm as the IDE and using the python.exe which pycharm uses, I found it is 32 bit (just click the python.exe and the command prompt like screen opens and first line tells if it is 32bit or 64 bit).
Then using the below link, I downloaded the Oracle Instant Client.
https://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html
I chose the 32 bit and 12.2 version (latest was v18.x at the time of writing this). This 32bit has to match your python version (which was also 32 bit in my case).
Then I extracted the zip file of instant client, put it in C:\oracle folder (doesn't matter where you put) and the my directory structure was..
C:\oracle\instantclient_12_2
Now I put this location as first location in my "Path" system environment variable of Windows machine.
After doing all this, I restarted machine (not needed) and used pycharm and connected like this...
import cx_Oracle as cxo
conn = cxo.connect("user_id", "password", "host_name:port_no/sid")
print(conn.version)
cur = conn.cursor()
cur.execute('SELECT \'X\' FROM DUAL')
for result in cur:
print(result[0])
cur.close()
conn.close()
You need to install same version of Python and database client.
For Example: 64 bit python and 64 bit client or both 32 bit will work.
I tired with Oracle XE 18c and python-3.8.3-amd64.exe
The error message has been improved in cx_Oracle 7.1 -- but the problem is that an older version (than 11.2) of the Oracle Client libraries has been detected. You need to make sure that the newer version you've installed is being detected. You can do that by ensuring that your PATH environment variable contains your 12.2 client libraries first. In the past, older versions of the Oracle Client libraries were often installed into C:\windows\system32.
The problem might be related to this issue.
In short:The Oracle Instant Client version 19.3.0.0.0 is not supported on Windows 7.
It is also mentioned in Operating System Checklist for Oracle Database Client Installation.
I had same problem DPI-1050: Oracle Client library is at version 0.0 but version 11.2 or higher is needed on Windows 10 with PyCharm and Selenium
I found that application which is installed in my pc contains oic.dll file. I know that application is in very old technology and first tried with that. Renamed that file to other and problem was solved. Connection with DB was successful
Only problem in my case is that next time when I will start that application it need that file, so i need to change file name back to oic.dll.
I recently installed cx_Oracle module on my machine, in order to connect to a remote Oracle database server. (I have no Oracle client at my side).
Python: Version 2.7 x86
Oracle: Verision 11.1.X x64
Cx_Oracle:Verion-5.1.2-11g.win32-py2.7
Then everytime I run my script, it fails and print the following message:
ImportError: DLL load failed: The specified module could not be found.
I found a related post at Here, so I am wondering if I anyway have to have an Oracle client at my side where the python script is invoked.
Can anyone help me out? Thanks in advance.
# - This import requires appropriate oraocciXX.dll to be available in PATH (on windows)
# (Probably LD_LIBRARY_PATH or LD_LIBRARY_PATH64 on POSIX)
# where XX is the oracle DB version, e.g. oraocci11.dll for Oracle 11g.
# - This dll is part of the Oracle Instant client pkg available here:
# http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
# - Also ensure that python, cx_Oracle and Oracle Client are of same arch (32 or 64-bit)
#
import cx_Oracle
You can find out arch (32 or 64-bit) for:
python by just running the python in interactive mode on command line.
cx_Oracle: look at the name of downloaded file.
Oracle Client:
run the sqlplus that's part of your client package
start Task Manager and see if sqlplus.exe has "*32" next to it (=32 bit) or not (=64 bit)
if you don't have sqlplus, use dumpbin /headers oraocciXX.dll
If you're using POSIX you probably would already know. Use file oraocciXX.so
Finally if you still don't understand here is really for dummies instructions:
Ensure you've installed 32-bit versions of python, cx_Oracle and Oracle Instant Client. These could also be 64-bit, but must be same for all 3. Can not mix and match. Links:
Oracle Instant Client Lets say it's installed in C:\ProgFiles\OraClient\11_2
cx_Oracle
Python
Windows:
set PATH=%PATH%;C:\ProgFiles\OraClient\11_2
POSIX (Linux/Unix/Solaris...) <-- Untested..
export LD_LIBRARY_PATH=/path/to/your/32bit/oraocciXX.so
(64 bit) export LD_LIBRARY_PATH64=/path/to/your/64bit/oraocciXX.so
run path-to-python/python.exe -c "import cx_Oracle" to test whether your setup is working or not.
if it prints
nothing: then it's successful.
ImportError: DLL load failed: The specified module could not be found: then oraocciXX is not found. Setup the env vars correctly.
ImportError: DLL load failed: %1 is not a valid Win32 application: You have a 32/64 bit mismatch.
Yes, you have to have an Oracle client installed at your side.
From the cx_ORacle README
"Please note that an Oracle client (or server) installation is required in order
to use cx_Oracle. If you do not require the tools that come with a full client
installation, it is recommended to install the Instant Client which is far
easier to install."
EDIT link to Instant Client: http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
After having been trying to solve this issue for days, I found out that set PATH=%PATH%:<insert Oracle home here> did not do the trick for me. I had to go into my Windows XP system properties and append the Oracle home to the 'path' variable under 'System variables'.
I cannot comment yet :-( but for uniquephase above, you may want to try to check the permissions of the .exe and .dlls to make sure they are executable?
So the steps I needed to do to get it working.
Unzip the instant client from here.
http://www.oracle.com/technetwork/topics/winx64soft-089540.html
chmod +x *.exe *.dll (I am using cygwin).
For completeness, I couldnt get cx_oracle to install via pip using cygwin.
So I had to use standard dist python (non-cygwin) and installed cx_oracle via the windows installer.
Also, I had to add f:/opt/instantclient_12_1 (location where I installed the Oracle instant client) to the Windows path (via System->Advanced System Properties->Environment Variables->System Variables).