Oracle & Ruby on Rails


#1

I’ve a remote database create using Oracle. This database use schemas.
I tried to connect to it using Ruby On Rails,with this file Database.yml
:

development:
adapter: oci
host: liber
database: ENERGIA
username: user
password: pass

test:
adapter: oci
host: liber
database: ENERGIA
username: user
password: pass

production:
adapter: oci
host: liber
database: ENERGIA
username: user
password: pass

Where “ENERGIA” is a schema’s name.
I want to create a model for a table named “Platts” that is into
ENERGIA.
I use this command: ruby script/generate scaffold platt action_name
But everytime Rails Tell me that this Table doesn’t exist!
Can someone tell me what’s the problem?


#2

On 2/20/06, Ivan M. removed_email_address@domain.invalid wrote:

I’ve a remote database create using Oracle. This database use schemas.
I tried to connect to it using Ruby On Rails,with this file Database.yml
:

You’ll also want to triple-check that your TNS_ADMIN environment
variable is correct.


#3

Ivan M. wrote:

Where “ENERGIA” is a schema’s name.
I want to create a model for a table named “Platts” that is into
ENERGIA.

The oracle adapter doesn’t use the database parameter.
You can connect passing a tnsnames.ora defined name in the host
parameter. e.g. If you have oracle client installed and this:

ORCL.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)

inside you tnsnames.ora then you can connect using

development:
adapter: oci
host: ORCL.WORLD
username: scott
password: tiger

If you don’t have a tnsnames.ora you can still connect passing the
hostname plus the sid to the host parameter e.g.:

development:
adapter: oci
host: hostname/ORCL
username: scott
password: tiger

Then the schema would be the default one for the scott user (probably
‘SCOTT’). in your case you probably need to connect with the ENERGIA
user.

HTH, bye
Luca M.

Blog: http://spazidigitali.com
Email mailto://removed_email_address@domain.invalid
Skype callto://l.mearelli