Using activerecord-jdbc-adapter to connect to db2 and specifying schema

I am converting my rails application(working fine) to jruby. I am using
db2 database, and connecting to it through activerecord-jdbc-adapter
gem. My db2 database has many schemas, and I have to query tables in
different schemas. My database.ywml file declares production environment
as :

adapter: jdbc
driver: com.ibm.db2.jcc.DB2Driver
url: jdbc:db2://remoteserver.com:50000/DB_NAME
username: uname
password: pwd

My questions is where can I specify the schema for my tables. e.g I have
a model like this

class User < ActiveRecord::Base

end

and when I query for this model, the query generated is
select * from uname.user
but table ‘user’ is located in ‘myschema’, and it has assumed to use
‘uname’ schema for the user ‘uname’. How, can i change configuration so
that query generated by adatper is
select * from myschema.user

any suggestion?

thanks,
Farooq

using set_table_name method has fixed the problem.

class User < ActiveRecord::Base
set_table_name(“myschema.user”)
end

but what if I have to work with two different schemas in same
application?

You should be able to append the currentSchema variable to the URL.
Don’t forget the semicolon at the end:

url: jdbc:db2://remoteserver.com:50000/DB_NAME:currentSchema=myschema;


Chris