Ruby, Solaris and Oracle drivers

Hi all,

Ruby 1.8.1 (64 bit)
Solaris 9
Oracle 9.2 (64 bit)
$ORACLE_HOME = /opt/oracle>file
Solaris ld

Additional info:

file /opt/bin/ruby
/opt/bin/ruby: ELF 64-bit MSB executable SPARCV9 Version 1,
UltraSPARC1 Extensions Required, dynamically linked, not stripped

file /opt/oracle/lib/libclntsh.so
/opt/oracle/lib/libclntsh.so: ELF 64-bit MSB dynamic lib SPARCV9
Version 1, dynamically linked, not stripped

ld -V
ld: Software Generation Utilities - Solaris Link Editors: 5.9-1.343

I’m having some issues with the various Oracle drivers - namely
Yoshida Masato’s Oracle driver and Jim Cain’s Ruby9i driver. I’ll
also mention the OCI8 driver where appropriate. As a test program, I
used this simple script:

dbitest.rb

require “dbi”
dbh = DBI.connect(dsn,user,passwd)
sth = dbh.prepare(“select sysdate from dual”)
sth.execute
rec = sth.fetch
p rec
sth.finish
dbh.disconnect

end

First, I want to be able to build and use these drivers without
relying on the LD_LIBRARY_PATH. Let’s start with Yoshida Masato’s
Oracle driver. Note that if I don’t add the -R option (below) it will
die with an ld error if LD_LIBRARY_PATH isn’t set.

LD_LIBRARY_PATH is NOT set (on purpose).
ruby extconf.rb
Hand edit Makefile and add “-R/opt/oracle/lib” to the DLDFLAGS option.
make
make site-install

A quick check on the command line using “ruby -r oracle -e 0” reveals
no problem. But, when I run dbitest.rb, I get this:

ruby dbitest.rb
/opt/lib/ruby/site_ruby/1.8/DBD/Oracle/Oracle.rb:86: [BUG] Bus Error
ruby 1.8.1 (2003-12-25) [sparc-solaris2.9]

Abort (core dumped)

···

On to Ruby9i (0.2.1 with patch by Paul Williams). I follow the same
steps:

LD_LIBRARY_PATH is NOT set
ruby extconf.rb
Hand edit Makefile and add “-R/opt/oracle/lib” to the DLDFLAGS option
make
make site-install
Copied Ruby9i.rb to /opt/lib/ruby/site_ruby/1.8/DBD/Ruby9i

ruby dbitest.rb
/opt/lib/ruby/site_ruby/1.8/DBD/Ruby9i/Ruby9i.rb:48:in prepare': undefined method ses_h’ for #Ruby9i::Database:0x100229e38
(NoMethodError)
from /opt/lib/ruby/site_ruby/1.8/dbi/dbi.rb:615:in `prepare’
from dbitest.rb:16

Did I install the DBD incorrectly? Or is there an issue with the
driver?


The ruby-oci8 driver, however, appears to work flawlessly. I didn’t
have to edit the Makefile and yet it works without having
LD_LIBRARY_PATH set. So, what did OCI8 do right that the other two
did wrong? That, or what am I doing wrong?

Quick aside - is there a way to set the runtime path with mkmf?

Any and all help appreciated.

Regards,

Dan

Hi,

djberg96@hotmail.com (Daniel Berger) writes:

Hi all,

Ruby 1.8.1 (64 bit)
Solaris 9
Oracle 9.2 (64 bit)
$ORACLE_HOME = /opt/oracle>file
Solaris ld
(snip)

ruby dbitest.rb
/opt/lib/ruby/site_ruby/1.8/DBD/Oracle/Oracle.rb:86: [BUG] Bus Error
ruby 1.8.1 (2003-12-25) [sparc-solaris2.9]

Abort (core dumped)

I don’t have 64 bit oracle server and I hadn’t tested it on
Solaris. But I suppose that it may be solved by adding
“-DSS_64BIT_SERVER” to the CFLAGS option. That’s because the size of
Lda_Def and Cda_Def depends on whether SS_64BIT_SERVER is set or not.

The ruby-oci8 driver, however, appears to work flawlessly. I didn’t
have to edit the Makefile and yet it works without having
LD_LIBRARY_PATH set. So, what did OCI8 do right that the other two
did wrong? That, or what am I doing wrong?

Oracle and Ruby9i build linker options by itself. But ruby-oci8 gets
linker options from $ORACLE_HOME/rdbms/demo/demo_rdbms.mk.
I suppose it added “-R$ORACLE_HOME/lib”.

···


KUBO Takehiro
email: kubo@jiubao.org
web: http://www.jiubao.org
GnuPG fingerprint = 5F7B C8EF CA16 57D0 FDE1 9F47 C001 1F93 AC08 2262