Accessing Legacy Derby Database From Rails (how to set schema?)

I have a legacy Derby database that I am trying to access from Rails.
is my database.yml as currently configured:

adapter: jdbcderby
database: db/perm
schema: app (also tried APP)

My tables are in the “APP” schema in the database.

Originally tried it with no “schema” setting and it used the SA schema
apparently by default.

I am able to connect this way and when I run the Rails console and do
ActiveRecord::Base.connection.tables I get the list of tables (there is
indicuation of schema). All tables are listed in lower case.

But I cannot figure out how to make a model that can access these
When I do a basic model I get an exception “Schema ‘SA’ does not exist”
whenever I do a query via ActiveRecord. I tried various ways of setting
the table name in the model (using set_table_name) but nothing worked.

Can anyone tell me what I am missing?

I posted this on SE with some more information (although I think all you
would need is probably in this email):



I’ve recently switched to using Sequel for a project that also just
switched to use Derby for our embedded database, and have found a few
kinks here and there but support is pretty good. It appears “APP” is the
default schema, and was recognized that way automatically for me.

url: jdbc:derby:db/perm

that should probably do it for you if you want to give Sequel a go.

Matt H.


Thanks for your reply.

I eventually got it to work by setting username: APP and schema: APP in
database.yml. All due to lucky guesses and a hint from a respondent on
due to absence of any found documentation on this.