# Importing existing Oracle DB to Ruby

**URL:** <https://www.ruby-forum.com/t/importing-existing-oracle-db-to-ruby/69253>\
**Category:** Rails\
**Created:** [September 19, 2006, 6:48pm UTC](https://www.ruby-forum.com/t/importing-existing-oracle-db-to-ruby/69253 "2006-09-19T18:48:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 19, 2006, 6:48pm UTC](https://www.ruby-forum.com/t/importing-existing-oracle-db-to-ruby/69253/1 "2006-09-19T18:48:32Z")

</div>

We are moving ColdFusion applications to Ruby on Rails and we would  
like to keep our existing data. Is there a way to import the Oracle  
schema into Ruby using one of the commands?

Thanks!

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 19, 2006, 7:08pm UTC](https://www.ruby-forum.com/t/importing-existing-oracle-db-to-ruby/69253/2 "2006-09-19T19:08:39Z")

</div>

What do you mean by ‘import into Ruby’? ActiveRecord (the database  
library  
of Rails) is capable of communicating with Oracle databases.

Jason

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 19, 2006, 7:10pm UTC](https://www.ruby-forum.com/t/importing-existing-oracle-db-to-ruby/69253/3 "2006-09-19T19:10:39Z")

</div>

On 9/19/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> We are moving ColdFusion applications to Ruby on Rails and we would  
> like to keep our existing data. Is there a way to import the Oracle  
> schema into Ruby using one of the commands?
> 
> Thanks!

I’m not sure what you’re asking. The schema isn’t “in” ruby. You can  
access it without any change at all to the database if you like.  
Might require some tweaking to your ActiveRecord models if the schema  
is not using AR’s naming conventions (which would be a miracle if it  
were.)

_OR_, you can port it to what ActiveRecord expects with its defaults,  
which will make ongoing development quite a bit easier.

–  
Imagination is more important than knowledge. – Albert Einstein

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 19, 2006, 7:32pm UTC](https://www.ruby-forum.com/t/importing-existing-oracle-db-to-ruby/69253/4 "2006-09-19T19:32:42Z")

</div>

Hi !

2006/9/19, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I suppose I’m looking for is a tutorial or a way to have a Ruby app  
> created based on an existing schema. I’m a newbie so I’m not sure if I  
> mean a scaffold. The examples I’ve found so far let me create new  
> databases which work fine. Sorry for the confusion.

Hmmm, I’d say that the scaffolding is what you want, to at least see  
if you can access your existing data.

Start with a fresh Rails application. Setup config/database.yml  
correctly. Then, use the console to confirm you can communicate with  
the database:

$ script/console

> ActiveRecord::Base.connection.execute(“SHOW TABLES”)

If you get an error, your connection parameters are incorrect.

Then, you can start building your scaffold:

$ script/generate scaffold User

Hope that helps !  
FranÃ§ois Beausoleil

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 19, 2006, 7:22pm UTC](https://www.ruby-forum.com/t/importing-existing-oracle-db-to-ruby/69253/5 "2006-09-19T19:22:40Z")

</div>

Let me clarify,

I suppose I’m looking for is a tutorial or a way to have a Ruby app  
created based on an existing schema. I’m a newbie so I’m not sure if I  
mean a scaffold. The examples I’ve found so far let me create new  
databases which work fine. Sorry for the confusion.

Thanks
