Table SCHEMA_MIGRATIONS does not exist (even though it does)

Still running a simple “smoke test” on building a Rails 3 app using
jRuby 1.6.1 and ar-jdbc 1.1.1 (found here:
Created a Rails project. Ran scaffold command and went on to create a
schema and then ran rails db:migrate…

** Execute db:migrate
rake aborted!
Table SCHEMA_MIGRATIONS does not exist
arjdbc/jdbc/ columns' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.1.1 /lib/arjdbc/db2/adapter.rb:308:incolumns’
columns' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/arel-2.0.9/lib/arel/table.rb:104:in[]’
get_all_versions' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-3.0.7/lib/active_record/migration.rb:583:inmigrated’
current_version' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-3.0.7/lib/active_record/migration.rb:509:inmigrate’
org/jruby/ detect' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-3.0.7/lib/active_record/migration.rb:509:inmigrate’
up' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-3.0.7/lib/active_record/migration.rb:415:inmigrate’
(root)' org/jruby/’
org/jruby/ call' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:inexecute’
org/jruby/ each' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute’
invoke_with_call_chain' /usr/local/jruby-1.6.1/lib/ruby/1.8/monitor.rb:191:inmon_synchronize’
invoke_with_call_chain' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:ininvoke’
invoke_task' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level’
org/jruby/ each' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling’
run' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31:in(root)’
org/jruby/ load' /usr/local/jruby-1.6.1/bin/rake:19:in(root)’


username: pete
password: xxxxxxxxx
adapter: jdbc
url: jdbc:as400://;naming=sql;

Warning: The database defined as “test” will be erased and

re-generated from your development database when you run “rake”.

Do not set this db to the same as development or production.

username: pete
password: xxxxxxxxxx
adapter: jdbc
url: jdbc:as400://;naming=sql;

username: pete
adapter: jdbc
url: jdbc:as400://;naming=sql;

Looking at the schema contents I CAN see the table. If I drop and
recreate the schema and run the migrate, it will rebuild the
SCHEMA_MIGRATIONS table but still reports it as MIA. I don’t see any
errors at the server side but don’t know where to look next.

Pete H.
Value Added Software, Inc

On Fri, May 6, 2011 at 6:28 PM, Pete H. [email protected] wrote:



username: pete
url: jdbc:as400://;naming=sql;

To unsubscribe from this list, please visit:

I would suggest 2 things:

1/ try to access the db using the same jdbc connector but this time
with Sequel, outside of rails. This is to validate the jdbc connector
works well. Which version are you using by the way ?

2/ move away from as400 and use H2 instead. Since you’re using jruby,
it’s a pretty decent pure java db, and you can go for a file based
approach or a pure memory approach. I usually use jdbc:h2:mem: when I
develop and it’s not deployed yet.



This will work with MySQL so I think it is specific the DB2 for i
(AS/400) driver that is provided with AR-JDBC. If I use an older
version of the driver (adapter.rb under DB2) , one that I wrote a while
back, I can get past the missing SCHEMA_MIGRATIONS error but it chokes
on another error. Seems with the changes to AR-JDBC, Rails and the DB2
for i adapter something is broke. Is there anyone else using the DB2
for i (as400) driver successfully?

Changing DB’s is not an option.

Pete H.
Value Added Software, Inc

Not sure what happened to the “Table SCHEMA_MIGRATIONS does not exist”
error. It doesn’t occur any longer. However I do get a
“ActiveRecord::JDBCError: [SQL0204] PRIMARY_KEY in *LIBL type *SQLUDT
not found.” error now. DB2 for IBM i doesn’t handle a primary key
directly so there is logic in the driver that will change the syntax.
However, that doesn’t seem to be invoked so I am wondering if I am
invoking the driver at all.

I have arjdbc installed and it lists as a bundled gem but I can’t see
why the proper syntax isn’t used. I have the following in my yaml:

username: xxxxx
adapter: jdbc
url: jdbc:as400://;naming=system;

In jruby 1.4 using arjdbc 0.9.2 this all works great. In jruby 1.6.1
using arjdbc 1.1.1 with a Rails 3.0 app get the error message above.
Any clues how to best sort this out? Debug statements in the driver

Pete H.
Value Added Software, Inc

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs