Tuesday, October 18, 2011

Compile the CX_Oracle

cx_Oracle is python library that help us connect to Oracle database run qery to retrieve data or update data in database
before use it we need setup the machine that use cx_Oracle
1)setup env variable call ORACLE_HOME,it should point to the path that Oracle database,standard client,or instant client(basic client,and SDK) installed
2)if still get error that can not import cx_Oracle from python,we need compile and install cx_Oracle in the machine it will be used
3)setup Oracle_Home as i said before,setup LD_LIBRARY_PATH to $ORALCE_PATH/lib folder
4) go to cx_Oracle folder,execute python setyp.py build,if it complains about one library can not be found,go to ORACLE_HOME(instant client),create a link for the library with the name gcc requested with the file has similar name but attach a version with the file.re-run build,if it success,then run python setup.py install,this one should be has a root privilege,otherwise will fail on copying file
5) when we connection to Oracle,we also need setup service name(tns name) in tnsnames.ora
we are good to go

No comments:

Post a Comment