How to execute oracle store procedure using Jruby

Dear all

Sorry that I am very green to jruby. Is there any example to show how to
execute store procedure in oracle. I have used google to search, but the
result is not in my expectation.

I have a store procedure (PROC_UTIL_CHK_HKID_FORMAT) which have 2 params
param-1 char input
param-2 integer output

I have tried the following, but failed…so depress now
require ‘dbi’

jdbc_url = “dbi:Jdbc:oracle:thin:@host:12345:AAAA1234”
jdbc_driver = “oracle.jdbc.driver.OracleDriver”
dbh = DBI.connect(jdbc_url, “ABC”, “ABC”, { “driver” => jdbc_driver } )

db_read_str = ‘BEGIN :out1 := PROC_UTIL_CHK_HKID_FORMAT(hkid=>:in1);
END;’
puts db_read_str
sth_db = dbh.prepare(db_read_str)
sth_db.bind_param(“out1”, ’ ’ * 5 )
sth_db.bind_param(“in1”, “A1234563”)
sth_db.execute
puts sth_db.func(“bind_value”, “out1”)

The following error happened
sth_db.bind_param(“out1”, ’ ’ * 5 )
NameError: uninitialized constant
DBI::DBD::Jdbc::Statement::InterfaceError
from /appl/lis/jruby-1.2.0/lib/ruby/1.8/irb/ruby-token.rb:54:in
const_missing' from /appl/lis/jruby-1.2.0/lib/ruby/gems/1.8/gems/dbd-jdbc-0.0.5/lib/dbd/jdbc/statement.rb:45:inbind_param’
from
/appl/lis/jruby-1.2.0/lib/ruby/gems/1.8/gems/dbi-0.4.1/lib/dbi/handles/statement.rb:96:in
bind_param' from (irb):25:inirb_binding’

Please help me…Thank you so much
Valentino

See
http://github.com/rsim/ruby-plsql/tree/master

Also see raimonds blog for some good oracle info
http://blog.rayapps.com/category/plsql/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs