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:
Getting Started with Rails — Ruby on Rails Guides)
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/RubyJdbcConnection.java:121:in 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:in columns’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/arel-2.0.9/lib/arel/table.rb:97:in
columns' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/arel-2.0.9/lib/arel/table.rb:104:in []’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-3.0.7/lib/active_record/migration.rb:454: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:in migrated’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-3.0.7/lib/active_record/migration.rb:492:in
current_version' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-3.0.7/lib/active_record/migration.rb:509:in migrate’
org/jruby/RubyEnumerable.java:552:in detect' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-3.0.7/lib/active_record/migration.rb:509:in migrate’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-3.0.7/lib/active_record/migration.rb:433:in
up' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-3.0.7/lib/active_record/migration.rb:415:in migrate’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-3.0.7/lib/active_record/railties/databases.rake:142:in
(root)' org/jruby/RubyProc.java:260:in call’
org/jruby/RubyProc.java:228:in call' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute’
org/jruby/RubyArray.java:1602:in each' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in
invoke_with_call_chain' /usr/local/jruby-1.6.1/lib/ruby/1.8/monitor.rb:191:in mon_synchronize’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
invoke_with_call_chain' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in
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/RubyArray.java:1602:in 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’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in
run' /usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31:in (root)’
org/jruby/RubyKernel.java:1063:in load' /usr/local/jruby-1.6.1/bin/rake:19:in (root)’

database.yaml:

development:
username: pete
password: xxxxxxxxx
adapter: jdbc
driver: com.ibm.as400.access.AS400JDBCDriver
url: jdbc:as400://10.0.10.205/blog;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.

test:
username: pete
password: xxxxxxxxxx
adapter: jdbc
driver: com.ibm.as400.access.AS400JDBCDriver
url: jdbc:as400://10.0.10.205/blog_test;naming=sql;

production:
username: pete
password:xxxxxxxxxxxxxx
adapter: jdbc
driver: com.ibm.as400.access.AS400JDBCDriver
url: jdbc:as400://10.0.10.205/blog_prod;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.
Suggestions?


Pete H.
Value Added Software, Inc
www.asaap.com
www.opensource4i.com

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

/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.1.1
current_version' (root)’
/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in

/usr/local/jruby-1.6.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in`run’

development:
username: pete
url: jdbc:as400://10.0.10.205/blog_prod;naming=sql;
www.opensource4i.com


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

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.


Christian

Christian,

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
www.asaap.com
www.opensource4i.com

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:

development:
username: xxxxx
password:xxxxxx
adapter: jdbc
driver: com.ibm.as400.access.AS400JDBCDriver
url: jdbc:as400://10.0.10.205/blog;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
maybe?

Pete H.
Value Added Software, Inc
www.asaap.com
www.opensource4i.com