Hello,
I have an odd problem here where two different database drivers (and
databases) exhibit different behavior during Model.new:
** Database 1: DB2 on Linux – using db2jcc4.jar
a = Assessment.new
=> #<Assessment id: nil, username: nil, skill_id: nil, created_at: nil,
updated_at: nil, level_id: nil, shadow_request: nil, approved: nil,
reason: nil>
** Database 2: DB2 on IBM i (i5/OS) – using jdbc_db2.rb patched to
catch as400 in the url for jt400.jar
a = Assessment.new
=> #<Assessment id: nil, username: “”, skill_id: 0, created_at: nil,
updated_at: nil, level_id: 0, shadow_request: 0, approved: 0, reason:
“”>
All boolean, integer (except id) and string column types default to 0
(false), 0 and ‘’ respectively instead of nil using DB2 on IBM i… eek!
Only datetime works as expected.
I double and triple checked the underlying table defaults to NULL for
all these columns… And using simple INSERT tests show this to be
working correctly. So… how does ActiveRecord (or the JRuby JDBC
adapter) determine what these default values should be?
I’m using JRuby 1.5.1, Rails 2.3.8 and activerecord-jdbc-adapter 0.9.7.
Same behavior in Rails 3.0.0.beta4 as well.
Thanks!
- nick
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email