[cx-oracle-users] Python and Oracle DB API (cx_oracle)
Brought to you by:
atuining
From: Me <zed...@ya...> - 2011-06-04 02:33:37
|
Hello All I'm newbie to Python, Oracle and Apache 2.2 I've installed python 2.7 (ActiveState version), apache 2.2 and Oracle 10g XE. All of them running in the same machine with XP as a OS. I yet don't have 'mod_python' installed but I am planing to do so later. (just using CGI script for time being although for web development i've read mod_python is the best.) I just download the 'cx_Oracle-4.1.2-win32-10g-py27.exe' from the Oracle web site which is: (http://www.oracle.com/technetwork/articles/piotrowski-pythoncore-084049.html) the installation went smooth with no problem as the above site walks through. then as site instructed::Create a file ora.psp under APACHE_HOME/htdocs to see whether the cx_Oracle module is working properly. -------------------------------------- <% import cx_Oracle db = cx_Oracle.connect('username', 'password', '127.0.0.1/XE') c = db.cursor() c.execute('select * from dual') req.write(c.fetchall()[0][0]) db.close() %> I put my username\pass for log in to Oracle as it works with database after login. ------------------------------------ i did save the file in notepad and put it in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ora.psp ( i saved as: "ora.psp" to eliminated the extra extention) when i go to url: ( http://127.0.0.1/ora.psp ) it just shows the content of the file like in notepad.(plain code) as it supposed to show 'x' in browser. (as a result of execuation of file) Apache 2.2 runs in port 80 (default) Oracle : http://127.0.0.1:8080/apex/f?p=4550:11:4261762709150240::NO::: (login page) However at python command prompt when I execute the following: >>> import cx_Oracle >>> print 'The version of cx_oracle is: ', cx_Oracle.version The version of cx_oracle is: 5.1 ------------------------------------ Please help me to fix this test which is for connection to oracle. Is it because of I yet don't have mod_python installed in my machine? Your help much appreciated. Pink Floyd: >>>> We are all equal at the end. |