Thursday, June 12, 2008

cx_Oracle and Oracle XE on Ubuntu

Simplifying options have appeared since the last time I posted about installing cx_Oracle against Oracle XE on Ubuntu, so I thought I'd produce an updated, simplified summary.
  1. Install Oracle XE from Oracle's own repository of .deb files
  2. export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    export PATH=$ORACLE_HOME/bin:$PATH
  3. sudo apt-get install python-dev python-setuptools
    sudo -E easy_install cx_Oracle

    The -E flag carries your environment variables into your sudo session; if you omit it, you may get a cannot locate an Oracle software installation error.
  4. Test:
    $ python
    >>> import cx_Oracle
    >>> cnxn = cx_Oracle.connect('system/mysystempassword@xe')
    >>> crsr = cnxn.cursor()
    >>> crsr.execute('SELECT * FROM dual')

Monday, June 09, 2008

cmd2 0.3.4

I just keep having fun with cmd2 (and with sqlpython, which is built on cmd2 and inherits its goodies). The latest:
  • If you use > to redirect output and omit a destination filename, your output will go into the paste buffer. Then you can Ctrl-V and paste it into any window.
  • You can use the pipe symbol (|) just like in Unix, to redirect output into any shell command.