A couple of things:

Can you provide the exact parameters that are passed in to set_ps_arg?

What version of JRuby are you on?

Have you tried to manipulate a Date in irb?

- Be gentle, I'm trying to type on a phone.  

On Dec 15, 2010, at 7:07, Wei <[email protected]> wrote:

> That anonymous class is not about "arg", but is referring the cps,
> which is created on jdbc.rb line 299,
> basically when it runs to
> cps.setDate(i.arg)
> exception is thrown.
> The funny part is, the switch/case statement will recognize arg as a
> Date type, but next line when Jruby tries
> to resolve cps.setDate, it fails to recognize arg as a Date.
> 
> Here are the modified jdbc.rb to show some debug info
> 
> def set_ps_arg(cps, arg, i)
>        puts "Debug arg class is #{arg.class}, arg value is #{arg}"
>        case arg
>        ....
>        when Date, Java::JavaSql::Date
>          begin
>            cps.setDate(i, arg)
>          rescue Exception=>e
>            puts e.message
>            puts e.backtrace
>          end
>        .....
>        else
>          cps.setObject(i, arg)
>        end
>      end
> And here are the output:
> 
> Debug arg class is Date, arg value is -2010-10-12
> no setDate with arguments matching [class org.jruby.RubyFixnum, class
> org.jruby.RubyObject] on object #<#<Class:01x41692a49>:0x705789f3>
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/adapters/jdbc.rb:304:in `execute_prepared_statement'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/adapters/jdbc.rb:304:in `each'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/adapters/jdbc.rb:304:in `execute_prepared_statement'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/connection_pool/threaded.rb:84:in `hold'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/database/connecting.rb:226:in `synchronize'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/adapters/jdbc.rb:294:in `execute_prepared_statement'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/adapters/jdbc.rb:191:in `execute'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/adapters/jdbc.rb:227:in `execute_insert'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/dataset/actions.rb:557:in `execute_insert'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/adapters/jdbc.rb:493:in `execute_insert'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/dataset/actions.rb:281:in `insert'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/adapters/shared/oracle.rb:122:in `insert'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/dataset/prepared_statements.rb:124:in `run'
> /home/whong/src/gto/cax/vendor/gems/jruby/1.8/gems/sequel-3.18.0/lib/
> sequel/dataset/prepared_statements.rb:29:in `call'
> 
> 
>> Like I told you by email, you need to include your code and the full
>> backtrace.  However, since JRuby is showing the object as a #<#<Class:
>> 01x404fe94c>:0x2b49a2c8>, I don't think it's going to do much good.
>> That's an instance of an anonymous class.  Are you sure you are
>> passing in a ruby Date object?
>> 
>> Jeremy
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sequel-talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/sequel-talk?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to