I’m trying to write a jruby script that connects to an oracle database using jdbc.
Thusfar I’ve got:
require 'rubygems'
require 'jdbc_adapter'
require 'active_record'
require 'active_record/version'
ActiveRecord::Base.establish_connection(
:adapter => 'jdbc',
:driver => 'oracle.jdbc.driver.OracleDriver',
:url => 'jdbc:oracle:thin:@mydatabase:1521:mydb',
:user => "user",
:password => "password"
)
ActiveRecord::Base.connection.execute("SELECT * FROM MYTABLE")
The error I’m getting:
C:/Program Files/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.2/lib/active_record/connection_adapters/jdbc_adapter.rb:326:in `initialize’: The driver encountered an error: java.sql.SQLException: invalid arguments in call (RuntimeError)
Suggestions?
The post below implies that you should use
:usernameinstead of:userin your connection call:http://www.ruby-forum.com/topic/143105
as well as the thread of this posting:
http://osdir.com/ml/lang.jruby.user/2007-05/msg00182.html