Skip to content
Ryan Culpepper edited this page Mar 24, 2018 · 18 revisions

ODBC Oracle Notes

Summary for users

Use #:quirks (no-c-bigint)

No parameter types (unknown) -- #:strict-parameter-types? #t gives all params type varchar.

Notes to self

Fetching DECIMAL/NUMERIC fields works using SQL_ARD_TYPE.


Setting up a testing environment

Whenever using ODBC driver:

  • export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib (or 12.2, for newer version)

Whenever using oracle software directly, must set ORACLE_HOME env var:

  • export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe

Setup for Centos 7.4

  • yum install bc nmap-ncat
  • run rpm on downloaded file
  • Post-install configuration: as root /etc/init.d/oracle-xe configure
    • 8080, 1521, (standard password, but letters only)

Installation automatically creates database XE, user system, password entered in installation

Create a new user:

Misc other links:

Setup 12c

Failed because of X11 issues.

Reference

ODBC Configuration

References:

Issue: cannot load driver library

Now the following works:

Issue: cannot connect with ODBC DSN

Issue: tests fail with "[unixODBC][Oracle][ODBC][Ora]ORA-12516: TNS:listener could not find available handler with matching protocol stack"


Issues

Issue: SQL_C_[SU]BIGINT not supported

Issue: TIME type broken

  • (prepare c "select time '12:34:56' as thing from dual") raises error: "bytes->string/utf-8: ending index is out of range; ending index: 11040..."
  • SQLDescribeCol returns garbage size for column name, garbage typeid (varies run to run)

Issue: some tests failed because Oracle sometimes converts Integer (values/fields) to Decimal (and then Real?)

Issue: numeric roundtrip test fails because parameter sent as SQL_C_DOUBLE.

  • FIXME: add option to send exact as numeric (if exact? if ...?)

Issue: DATE type returned as sql-timestamp

Issue: sometimes quitting interactive racket hangs when connection is open

  • the following interactions seem to reliably produce a hang-on-exit:

    > (begin (require db) (define c (dsn-connect 'ora)))
    > (define p (prepare c "select cast(17 as integer) from dual"))
    > (define p2 (prepare c "select cast(17 as integer) from dual"))
    
  • seems to require at least two statements prepared (?)

  • doesn't hang if only one statement allocated

  • doesn't hang if connection disconnected (explicitly or via custodian shutdown)

  • doesn't hang if statements freed explicitly with (send p finalize #t)

  • gdb backtrace

    #0  0x00007f07354b5945 in pthread_cond_wait@@GLIBC_2.3.2 ()    from /lib64/libpthread.so.0
    #1  0x00007f0723691057 in SltsPrWrite ()    from /usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1
    #2  0x00007f0725a7ccdb in bccFreeProcess ()   from /usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
    #3  0x00007f0725a8cb11 in _LibProc ()   from /usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
    #4  0x00007f0725a8cce5 in finiSqora ()   from /usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
    #5  0x00007f0725a24d12 in __do_global_dtors_aux ()   from /usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
    #6  0x00007fffa665c480 in ?? () 
    #7  0x00007f0725a8cdb1 in _fini ()   from /usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1