Bugs item #9131, was opened at 2007-03-08 19:56
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=9131&group_id=2014
Category: AR-JDBC
Group: 0.2.3
>Status: Closed
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: org.postgresql.Driver RuntimeError
Initial Comment:
Hi,
I'm getting a RuntimeError when trying to load an Object via ActiveRecord-JDBC
from JRuby.
The connect works fine von "normal" Ruby with the native Driver "ruby-postgres".
CONNECTION-PARAMS===============================================================
ActiveRecord::Base.establish_connection(
:adapter => 'jdbc',
:driver => 'org.postgresql.Driver',
:url => 'jdbc:postgresql://localhost:5432/db_name?schema=test_schema',
:username => 'user',
:password => 'pass'
)
STACKTRACE======================================================================
RuntimeError:
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.2.3/l
ib/active_record/connection_adapters/jdbc_adapter.rb:196:in `initialize'
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.2.3/l
ib/active_record/connection_adapters/jdbc_adapter.rb:8:in `new'
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.2.3/l
ib/active_record/connection_adapters/jdbc_adapter.rb:8:in `jdbc_connection'
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/a
ctive_record/connection_adapters/abstract/connection_specification.rb:262:in `se
nd'
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/a
ctive_record/connection_adapters/abstract/connection_specification.rb:262:in `co
nnection='
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/a
ctive_record/query_cache.rb:54:in `connection='
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/a
ctive_record/connection_adapters/abstract/connection_specification.rb:230:in `re
trieve_connection'
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/a
ctive_record/connection_adapters/abstract/connection_specification.rb:78:in `con
nection'
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/a
ctive_record/base.rb:763:in `columns'
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/a
ctive_record/base.rb:2064:in `attributes_from_column_definition'
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/a
ctive_record/locking/optimistic.rb:45:in `attributes_from_column_definition_with
_lock'
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/a
ctive_record/base.rb:1503:in `initialize'
from C:/Programme/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/a
ctive_record/callbacks.rb:225:in `initialize_with_callbacks'
from (irb):1:in `new'
from (irb):1:in `binding'
irb(main):015:0>
----------------------------------------------------------------------
>Comment By: Ola Bini (olabini)
Date: 2007-08-11 15:23
Message:
This seems to be fixed in trunk now.
----------------------------------------------------------------------
Comment By: Ryan Bell (kofno)
Date: 2007-03-19 05:42
Message:
I can't tell what may be causing this error, but it seems likely that it's
related to the decimal mapping problem that happens on Oracle. I've posted a
fix for that, so could you try building the AR-JDBC gem from source and see it
your Postgres problem goes away?
----------------------------------------------------------------------
Comment By: Martin Plöger (martin_ploeger)
Date: 2007-03-13 18:39
Message:
This problem can be solved like Bug [#9107] "With Oracle Driver: unable to
choose type for decimal" by replacing in AR_TO_JDBC_TYPES
(jdbc_adapter.rb):
:decimal => [ lambda {|r| Jdbc::Types::DECIMAL
== r['data_type']}, ....
with
:decimal => [ lambda {|r| [Jdbc::Types::DECIMAL,
Jdbc::Types::NUMERIC].include?(r['data_type'])}, ....
like Julien already posted.
----------------------------------------------------------------------
Comment By: Martin Plöger (martin_ploeger)
Date: 2007-03-11 23:24
Message:
I forgot to mention that I'm on Windows XP (till I get my MacBook Pro). JRuby
0.9.8, latest Postgres-JDBC-Driver, ActiveRecord-JDBC 0.2.3.
Another thing: At work I tried a connection with oracle and I got the Numeric
Error, too (already posted by someone).
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=9131&group_id=2014
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel