Reorganized README.txt and added new file BUILD.txt based on an initial patch

from Corey Gaff.
This commit is contained in:
Anthony Tuininga 2008-12-05 05:09:39 +00:00
parent d802a08e9b
commit ce74a5db5b
3 changed files with 106 additions and 25 deletions

77
BUILD.txt Normal file
View File

@ -0,0 +1,77 @@
Linux Build Hints
-----------------
(Tested on RedHat 4.x, Gentoo 2008.0, Ubuntu 8.x, and Debian 4.x)
These hints are based on using Oracle's instantclient_11_1. It is necessary to
download both 'instantclient-linux-basic' and 'instantclient-sdk-linux' from
oracle.com in order to successfully compile.
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
Each compressed tarball needs to be extracted to the exact same location.
Uncompress and untar each file from the same location in order to achieve this
result. If placing into a system area such as /opt, /usr/local, make sure you
have the correct permissions to write to these filesystems and/or directories.
It is advisable to use the same account from start to finish for installing
cx_Oracle in order to prevent confusion with overwriting environment settings.
After both packages are untarred a link needs to be made inside the
instantclient_11_1 directory. For instantclient_11_1 the link looks like
libclntsh.so -> libclntsh.so.10.1. If you are using a different version
of the instant client simply adjust the link per the version of libclntsh.so.
For example, from inside the instantclient directory, type
ln -s libclntsh.so.x.x linbclntsh.so
Before building and compiling you must set ORACLE_HOME and LD_LIBRARY_PATH for
the installation user, presumably 'root' but not mandatory. Pay careful
attention not to lose environment settings if you change users via 'su' or
'sudo', etc.
OS X Build Hints
----------------
(Tested on Leopard 10.5.x)
The procedures for OS X are almost idential to Linux except for the package
names and a few environmental caveats. For OS X it is necessary to download
both 'instantclient-basic-macosx' and 'instantclient-sdk-macosx'.
For OS X it is mandatory to set DYLD_LIBRARY_PATH to $ORACLE_HOME. For the
instant client this is the location where you installed the packages. It is
necessary to set this environment variable as well as those specified for Linux
(ORACLE_HOME and LD_LIBRARY_PATH) inside $HOME/.profile and start a new shell
before testing cx_Oracle. If .profile does not exist, simply create one with
your favorite editor and add the necessary path info to these variables.
Example ($HOME/.profile):
-------------------------
export ORACLE_HOME=/usr/local/instantclient_11_1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
export DYLD_LIBRARY_PATH=$ORACLE_HOME
Building and Compilation
------------------------
Use the provided setup.py to build and install the module which makes use of
the distutils module. Note that on Windows, I have used mingw32
(http://www.mingw.org) and the module will not build with MSVC without
modification. The commands required to build and install the module are as
follows:
python setup.py build
python setup.py install
Testing (Post Installation Quick Test)
--------------------------------------
A very quick installation test can be performed from the command line using
the Python interpreter. Below is an example of how this done. After importing
cx_Oracle there should be a line containing only '>>>' which indicates the
library successfully loaded.
$ python
Python 2.5.2 (r252:60911, Oct 25 2008, 19:37:28)
[GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>>

View File

@ -1,13 +1,17 @@
Open Source Python/Oracle Utility - cx_Oracle
---------------------------------------------
cx_Oracle is a Python extension module that allows access to Oracle and
conforms to the Python database API 2.0 specifications with a few exceptions.
conforms to the Python database API 2.0 specifications with a number of
additions. The method cursor.nextset() and the time data type are not
supported by Oracle and are therefore not implemented.
See http://www.python.org/topics/database/DatabaseAPI-2.0.html for more
information on the Python database API specification.
information on the Python database API specification. See the included
documentation for additional information.
For comments, contact Anthony Tuininga at anthony.tuininga@gmail.com or use the
mailing list at http://lists.sourceforge.net/lists/listinfo/cx-oracle-users
For feedback or patches, contact Anthony Tuininga at
anthony.tuininga@gmail.com. For help or to ask questions, please use the
mailing list at http://lists.sourceforge.net/lists/listinfo/cx-oracle-users.
Please note that an Oracle client (or server) installation is required in order
to use cx_Oracle. If you do not require the tools that come with a full client
@ -15,24 +19,31 @@ installation, it is recommended to install the Instant Client which is far
easier to install.
BINARY INSTALL:
Binary Install
--------------
Place the file cx_Oracle.pyd or cx_Oracle.so anywhere on your Python path.
SOURCE INSTALL:
Source Install
--------------
This module has been built with Oracle 9.2.0, 10.2.0, 11.1.0 on Linux,
Solaris and Windows. It will likely build on other platforms and other Oracle
versions but I haven't tried them. Use the provided setup.py to build and
install the module which makes use of the distutils module. Note that on
Windows, I have used mingw32 (http://www.mingw.org) and the module will not
build with MSVC without modification. The commands required to build and
install the module are as follows:
Solaris and Windows. Others have reported success with other platforms
such as Mac OS X.
Use the provided setup.py to build and install the module which makes use of
the distutils module. Note that on Windows, I have used mingw32
(http://www.mingw.org) and the module will not build with MSVC without
modification. The commands required to build and install the module are as
follows:
python setup.py build
python setup.py install
See BUILD.txt for additional information.
USAGE EXAMPLE:
Usage Example
-------------
import cx_Oracle
@ -41,7 +52,6 @@ import cx_Oracle
connection = cx_Oracle.connect("user", "password", "TNS")
cursor = connection.cursor()
cursor.arraysize = 50
cursor.execute("""
select Col1, Col2, Col3
from SomeTable
@ -50,7 +60,7 @@ cursor.execute("""
arg_1 = "VALUE",
arg_2 = 5,
arg_3 = 15)
for column_1, column_2, column_3 in cursor.fetchall():
for column_1, column_2, column_3 in cursor:
print "Values:", column_1, column_2, column_3
@ -59,10 +69,3 @@ samples in the samples directory. You can also look at the scripts in the
cx_OracleTools (http://cx-oracletools.sourceforge.net) and the modules in the
cx_PyOracleLib (http://cx-pyoraclelib.sourceforge.net) projects.
EXCEPTIONS:
The only exception to the DB API specification is the lack of a nextset()
method which is not supported by Oracle.
Please see the included documentation for additional information.

View File

@ -41,7 +41,8 @@ BUILD_VERSION = "5.0a1"
dataFiles = None
if sys.platform in ("win32", "cygwin"):
baseName = "cx_Oracle-doc"
dataFiles = [ (baseName, [ "LICENSE.TXT", "README.TXT", "HISTORY.txt"]) ]
dataFiles = [ (baseName,
[ "BUILD.txt", "LICENSE.TXT", "README.TXT", "HISTORY.txt"]) ]
for dir in ("html", "html/_static", "samples", "test"):
files = []
fullDirName = "%s/%s" % (baseName, dir)
@ -55,7 +56,7 @@ if sys.platform in ("win32", "cygwin"):
dataFiles.append((fullDirName, files))
# define the list of files to be included as documentation for bdist_rpm
docFiles = "LICENSE.txt README.txt HISTORY.txt html samples test"
docFiles = "LICENSE.txt README.txt BUILD.txt HISTORY.txt html samples test"
# method for checking a potential Oracle home
def CheckOracleHome(directoryToCheck):