Posts Tagged ‘oracle’

cx_Oracle on ubuntu 9.04 jaunty

Short list:

  • find python version
python -V
Python 2.6.2
  • download appropriate rpm version: cx_Oracle-5.0.2-10g-py26-1.i386.rpm
  • install rpm using alien (as root or using sudo)
alien -i cx_Oracle-5.0.2-10g-py26-1.i386.rpm
  • fix location
cd /usr/lib/python2.6
ln -s site-packages/cx_Oracle.so
  • test
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/phantom/oracle (path to instantclient install)
..$ python -c 'import cx_Oracle'

if you don’t do the export you will get a:

python -c 'import cx_Oracle'
Traceback (most recent call last):
 File "<string>", line 1, in <module>
ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or directory

Oracle and java.util.Date

Q: Assume someone, for compatibility is storing java.util.Date values in Oracle as long values (number of milliseconds since the standard base time known as “the epoch”, namely January 1, 1970, 00:00:00 GMT), how to read these dates in sql?

A:

select TO_CHAR(TO_DATE('19700101000000','YYYYMMDDHH24MISS') + NUMTODSINTERVAL(start_time/1000, 'SECOND'), 'YYYY-MM-DD HH24:MI:SS') from qrtz_triggers
Related Posts with Thumbnails