How to make

  • ruby and make (or nmake on MSVC) commands in the environment variable PATH?

  • ruby is 1.8.0 or later? (Use ruby-oci8 0.1.x for ruby 1.6.x.)

For OCI installed by Oracle Universal Installer

make sure the environment variable ORACLE_HOME (or registry on Windows) is set correctly. run the the following commands.

make (or nmake on MSVC)

For OCI installed by Oracle Instant Installer

linux:

ruby setup.rb config -- --with-instant-client
make

others:

ruby setup.rb config -- --with-instant-client=/path/to/instantclient10_1
make (or nmake on MSVC)

On compilation failure

Please report the following information to [email protected].

  • last 100 lines of ‘ext/oci8/mkmf.log’.

  • the results of the following commands:

    ruby -r rbconfig -e "p Config::CONFIG['host']"
    ruby -r rbconfig -e "p Config::CONFIG['CC']"
    ruby -r rbconfig -e "p Config::CONFIG['CFLAGS']"
    ruby -r rbconfig -e "p Config::CONFIG['LDSHARED']"
    ruby -r rbconfig -e "p Config::CONFIG['LDFLAGS']"
    ruby -r rbconfig -e "p Config::CONFIG['LIBS']"
    ruby -r rbconfig -e "p Config::CONFIG['GNU_LD']"
    
  • if you use gcc:

    gcc --print-prog-name=ld
    gcc --print-prog-name=as
    
  • on platforms which can use both 32bit/64bit binaries:

    file $ORACLE_HOME/bin/oracle
    file `which ruby`
    echo $LD_LIBRARY_PATH
    

How to run unit test

before runing unit test,

  1. connect to Oracle as system:

    $ sqlplus system/<password_of_system>
    
  2. create user ruby:

    SQL> CREATE USER ruby IDENTIFIED BY oci8;
    

    or

    SQL> CREATE USER ruby IDENTIFIED BY oci8
       2 DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
    
  3. grant the privilege to connect and execute.

    SQL> GRANT connect, resource TO ruby;
    
  4. If the Oracle version is 8i or later:

    SQL> CREATE TABLE ruby.test_clob (filename VARCHAR2(40), content CLOB);
    
  5. connect to Oracle as sys

    $ sqlplus 'sys/<password_of_sys> as sysdba'
    
  6. grant the privilege for the unittest of blocking-mode.

    SQL> GRANT EXECUTE ON dbms_lock TO ruby;
    
  7. change test/config.rb as you like

Then you can run:

$ make check

or

$ nmake check   (If your compiler is MS Visual C++.)

TODO

  • more proper handling of OCI_SUCCESS_WITH_INFO.

  • more proper handling of NUMBER without its scale values.

  • support Timestamp.