# Specifying which Oracle schema to use with ActiveRecord

**URL:** <https://www.ruby-forum.com/t/specifying-which-oracle-schema-to-use-with-activerecord/95909>\
**Category:** Rails\
**Created:** [January 21, 2006, 4:04pm UTC](https://www.ruby-forum.com/t/specifying-which-oracle-schema-to-use-with-activerecord/95909 "2006-01-21T16:04:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [January 21, 2006, 4:04pm UTC](https://www.ruby-forum.com/t/specifying-which-oracle-schema-to-use-with-activerecord/95909/1 "2006-01-21T16:04:43Z")

</div>

We use Oracle in my company.

I have access to 2 schemas (or tablespaces?) :

1.SAL  
2.SALDATA

I use tables from both schemas. How do i tell active record which  
schema to look in for the table i  
want???

I’ve just managed to convince the boss to switch from Java to Rails so  
this would be a arse if i couldnt use both schemas.

Any help would be GREATELY appreciated!

Thanks,  
Chris

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [January 21, 2006, 4:28pm UTC](https://www.ruby-forum.com/t/specifying-which-oracle-schema-to-use-with-activerecord/95909/2 "2006-01-21T16:28:58Z")

</div>

so for example i might have table SAL.customers and table  
SALDATA.accounts. How do i tell active record which table to use?

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [January 23, 2006, 6:34am UTC](https://www.ruby-forum.com/t/specifying-which-oracle-schema-to-use-with-activerecord/95909/3 "2006-01-23T06:34:41Z")

</div>

Andy wrote:

> so for example i might have table SAL.customers and table  
> SALDATA.accounts. How do i tell active record which table to use?

Use #set\_table\_name (or #table\_name=) and include the schema name. So,  
something like:

class Account \< ActiveRecord::Base  
set\_table\_name “saldata.accounts”

…

end
