Connect Python to Oracle and pythonoracle
Http://wenku.baidu.com/link? Url = Response
Installation list
1. Python
Configure environment variables for Python
2. setuptools
Open hosts
Run: D :\> ez_setup.py
Configure environment variables for setuptools
3. pip
Easy_install pip
4. cx_Oralce
Command line installation failed
Find the installation file on the following blog:
Http://blog.csdn.net/linghe301/article/details/8115632
After installation, run import cx_Oracle in the command line Python command line.
The following error is reported,
ImportError: DLL load failed: % 1 is not a valid Win32 application.
Because the sub-database is 64-bit and cx_Oracle is also installed 64-bit, but the Oracle client installed is 32-bit, because PLSQL Developer only has 32-bit. Therefore, the cx_Oracle is replaced with a 32-bit installation.
5. Install pydev in MyEclipse
Http://www.blogjava.net/caojianhua/archive/2012/07/17/383324.html
Several ways to connect Python to oracle
Connection = cx_Oracle.connect (tp/tp @ ocn_test) # view the tns alias command running tnsping successfully Ping Utility forLinux: Version 9.2.0.8.0-Production on 27-SEP-201110: 47: 48 Copyright (c) 1997,2006, Oracle Corporation. allrights reserved. used parameter files:/opt /...... /Sqlnet. oraUsed TNSNAMES adapter to resolve the aliasAttempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 10.20.36.19) (PORT = 1520 ))) (CONNECT_DATA = (SID = ocntest) OK (10 msec) 2. user input password connection
Python connection Oracle error: DatabaseError: ORA-12514: TNS: Listeners currently cannot recognize services in the connection Descriptor
Local geological Error