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

Ec07624a89509923683ba0a0b9c9f06d?d=identicon&s=25 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.
Here
is my database.yml as currently configured:

development:
  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
no
indicuation of schema).  All tables are listed in lower case.

But I cannot figure out how to make a model that can access these
tables.
 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):

http://stackoverflow.com/questions/11596929/active...


Thanks,

Mark
6fffdf47ba23571d98546e0e990757d0?d=identicon&s=25 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
Ec07624a89509923683ba0a0b9c9f06d?d=identicon&s=25 Mark Fraser (Guest)
on 2012-07-23 18:24
(Received via mailing list)
Matt,

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
SE
due to absence of any found documentation on this.

Mark
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.