Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.1RC1
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:ruby 1.8.6 (2008-01-07 rev 5512) [sparc-jruby1.1RC1], activerecord-jdbc-adapter (0.7.1)
-
Number of attachments :
Description
When attempting to connect to a DB2 database, I get the following error:
/usr/local/jruby-1.1RC1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.7.1/lib/active_record/connection_adapters/jdbc_adapter.rb:303:in `initialize': The driver encountered an error: java.lang.NullPointerException: null (RuntimeError)
from /usr/local/jruby-1.1RC1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.7.1/lib/active_record/connection_adapters/jdbc_adapter.rb:46:in `new'
from /usr/local/jruby-1.1RC1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.7.1/lib/active_record/connection_adapters/jdbc_adapter.rb:46:in `jdbc_connection'
from /usr/local/jruby-1.1RC1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in `connection='
from /usr/local/jruby-1.1RC1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:259:in `retrieve_connection'
from /usr/local/jruby-1.1RC1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'
from ./rowcounts.rb:13
The script I am running is this:
require 'rubygems'
gem 'activerecord-jdbc-adapter'
require 'jdbc_adapter'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => 'jdbc',
:driver => 'COM.ibm.db2.jdbc.app.DB2Driver',
:url => 'jdbc:db2:OSU',
:username => 'db2inst1',
:password => 'db2admin'
)
conn = ActiveRecord::Base.connection
puts conn.active?
Under ruby 1.8.5 (2007-11-01 rev 4842) [sparc-jruby1.1b1], activerecord-jdbc-adapter (0.7.1), i also error out with this message:
java.lang.NoSuchMethodError: org.jruby.javasupport.JavaEmbedUtils.newObjectAdapter()Lorg/jruby/RubyObjectAdapter;
[snipped 730 line stack tace, see attached file for full stack trace]
It works as expected under ruby 1.8.5 (2007-11-01 rev 4842) [sparc-jruby1.1b1], activerecord-jdbc-adapter (0.6)
Despite the misleading Description above I am experiencing Null Pointer Exceptions when I try to use Rails 2.0.2 with an Oracle XE Database.
database.yml contains:
development:
adapter: jdbc
driver: oracle.jdbc.driver.OracleDriver
database: jdbc:oracle:thin:@localhost:1521:xe
username: rubyweblog_development
password: xxx