Import= cx_oracle.connect (' user name/password @ip/servicename'#1 parameters = Cx_oracle.connect (' username ' ' password ') ip/servicename'#3 parameters
Open the Tnsnames.ora under the D:\app\username\product\11.2.0\client_1\NETWORK\ADMIN path
The IP here describes the Host,servicename as service_name for the following connections
(DESCRIPTION =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST = 111.111.111.111) (PORT = 1521))
)
(Connect_data =
(service_name = ORCL)
)
)
At the beginning of the connection, Oracle on my machine is a 32-bit client connected to the 64-bit server side and the client is located in D:\app\username\product\11.2.0\client_1
When attempting to connect, the error will be as follows:
Cx_oracle.databaseerror:dpi-1047:64-bit Oracle Client Library cannot be loaded: "D:\app\sabre\product\11.2.0\client_1 \bin\oci.dll is not the correct architecture ". See Https://oracle.github.io/odpi/doc/installation.html#windows for help
Follow the link in the prompt to locate the Oracle 64-bit client file package, download it, put it in D:\instantclient_11_2, and then add the path to the system path and try connecting again.
Python connects Oracle