Tag Archives: thirty-two

[Solved] 64-bit Python calls 32-bit Oracle client error: Cx_Oracle.DatabaseError: DPI-1047

problem

The operating system is 64 bit Python and 32 bit Oracle client. For other reasons, the Oracle client cannot be changed to 64 bit, resulting in Cx_Oracle64 bit cannot be used, CX_Oracle32 bit cannot be installed.

reason

Under Windows environment, if 64 bit Python is installed, CX_Oracle is used, the 64 bit Oracle client is called by default. In this case, we can only install Cx_Oracle win_Amd 64-bit version.

Solution:

1. First install CX_Oracle matching the current Python version, my is Python 3.8. The installed version is: Cx_Oracle-8.3.0-cp38-cp38-win_amd64.whl

2. Download the relevant Oracle instantclient (instant client) and unzip it to a folder convenient for calling

Download address: https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html

The version I downloaded is: instantclient-basiclite-windows-x64-19.13.0.0.0dbru.Zip, you can try several times, there is always one for you

3. Unzip the instantclient and change the environment variable in the Python code to adjust the Oracle driver location.

My unzipped address is:

E:\software\Python\instantclient-basiclite-windows.x64-19.13.0.0.0dbru

The code adjustment method is

import os

os.environ[‘path’] =  r’E:\software\Python\instantclient-basiclite-windows.x64-19.13.0.0.0dbru\instantclient_19_13′

import cx_Oracle

Now CX_Oracle can call normally

[Solved] Oracle sql Use sys_guid() to Generate 32-bit id garbled

The main question
select sys_guid() from dual;

 

As you can see, the code is directly messed up.

Reason: SYS_GUID returns a globally unique identifier in the form of a 16-bit RAW type value

Solution:
Use the rawtohex() function method.

 

hextoraw(): convert a hexadecimal string to raw.

rawtohex(): convert raw string to hexadecimal.

Messy code solution.

select rawtohex(sys_guid()) from dual;

 

You can see that the garbled code is gone.

To lowercase.
select lower(rawtohex(sys_guid())) from dual;

Method to judge whether the DLL file is 32-bit or 64 bit (development error: unable to load library’d: \ eq2008_dll ‘: Õ Ҳ »µ ½ָ ¶)

Error: unable to load library’d: \ eq2008_ Dll’:Õ Ҳ »µ ½ָ ¶ (unable to load DLL file)

Reason: the loaded dynamic library DLL file is different from the JDK version. My JDK is 64 bit, while the DLL file is 32 bit. This error appears

After downloading the corresponding 64 bit DLL file on the Internet, no error will be reported

 

How to judge whether DLL file is 32-bit or 64 bit

Open the DLL file with DLL file, find the first ‘PE’, and check the letter after it. If it is D, it is 64 bits (as shown in the figure below)

If it is l, it is 32 bits (as shown in the figure below)

 

Reference link: https://blog.csdn.net/sumflower_ 96/article/details/79222461