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

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Mark Fraser (Guest)
on 2012-07-23 02:28
(Received via mailing list)
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):


Matt Hauck (Guest)
on 2012-07-23 18:15
(Received via mailing list)
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 Hauck
Mark Fraser (Guest)
on 2012-07-23 18:24
(Received via mailing list)

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.

This topic is locked and can not be replied to.