ActiveRecord JDBC error Generated keys not requested

I’m getting the following error while connecting to mysql using
activerecord-jdbcmysql-adapter (1.0.2). Rails 3.0.1.

ActiveRecord::JDBCError: Generated keys not requested. You need to
specify Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate()
or Connection.prepareStatement().: SET SQL_AUTO_IS_NULL=0

This occurs not matter what application I run it in to e.g. rake,
rails console, or from my app. Here’s the trace while running it from
rake:

jruby -S rake db:schema:dump --trace
(in /Users/MJW/Sites/test_app)
** Invoke db:schema:dump (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:schema:dump
rake aborted!
ActiveRecord::JDBCError: Generated keys not requested. You need to
specify Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate()
or Connection.prepareStatement().: SET SQL_AUTO_IS_NULL=0
/jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/
active_record/connection_adapters/abstract_adapter.rb:202:in log' /jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.0.2- java/lib/arjdbc/jdbc/adapter.rb:178:inexecute’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.0.2-
java/lib/arjdbc/mysql/adapter.rb:14:in configure_connection' /jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.0.2- java/lib/arjdbc/mysql/adapter.rb:385:ininitialize’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.0.2-
java/lib/arjdbc/jdbc/connection_methods.rb:6:in new' /jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.0.2- java/lib/arjdbc/jdbc/connection_methods.rb:6:injdbc_connection’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.0.2-
java/lib/arjdbc/mysql/connection_methods.rb:18:in mysql_connection' /jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/ active_record/connection_adapters/abstract/connection_pool.rb:230:innew_connection’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/
active_record/connection_adapters/abstract/connection_pool.rb:238:in
checkout_new_connection' /jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/ active_record/connection_adapters/abstract/connection_pool.rb:194:incheckout’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/
active_record/connection_adapters/abstract/connection_pool.rb:190:in
loop' /jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/ active_record/connection_adapters/abstract/connection_pool.rb:190:incheckout’
/jruby-1.5.3/lib/ruby/1.8/monitor.rb:191:in mon_synchronize' /jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/ active_record/connection_adapters/abstract/connection_pool.rb:189:incheckout’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/
active_record/connection_adapters/abstract/connection_pool.rb:96:in
connection' /jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/ active_record/connection_adapters/abstract/connection_pool.rb:318:inretrieve_connection’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
97:in retrieve_connection' /jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/ active_record/connection_adapters/abstract/connection_specification.rb: 89:inconnection’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/
active_record/railties/databases.rake:327
/jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/
active_record/railties/databases.rake:326:in open' /jruby-1.5.3/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/ active_record/railties/databases.rake:326 /jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:incall’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in
execute' /jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:ineach’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in
execute' /jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:ininvoke_with_call_chain’
/jruby-1.5.3/lib/ruby/1.8/monitor.rb:191:in mon_synchronize' /jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in
invoke' /jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
top_level' /jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ineach’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
top_level' /jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in
top_level' /jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
standard_exception_handling' /jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:inrun’
/jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/jruby-1.5.3/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:19:in `load’
/jruby-1.5.3/bin/rake:19

I’ve googled extensively to find a solution for this but no luck.
Any clues on the cause would be appreciated.
Thanks.

I finally found the cause of this. I had a mysql-connector-
java-5.1.13-bin.jar file in my $JRUBY_HOME/lib directory.
When I removed this is went to a mysql-connector-java-5.0.4-bin.jar
file further down in my jruby tree.
I’m not sure if it was the later version of mysql-connector-java that
was causing the problem or whether it didn’t like the CONNECTOR/J
jar file in the $JRUBY_HOME/lib directory.

I’m still getting this when I create a war file using warbler and run
the application under the Tomcat 6.0 server.
I no longer get the error when I run rake or the rails console in the
project directory.
Anyone have any ideas why the following statement occurs under Tomcat?

ActiveRecord::JDBCError: Generated keys not requested. You need to
specify Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate()
or Connection.prepareStatement().: SET SQL_AUTO_IS_NULL=0

Thanks.