Ruby with Oracle problem

I installed Ruby with Oracle 10g and ran the ruby ...mswin.rb for oracle following the Oracle Ruby FAQ. But then when I try to test the connection using the following command

ruby -r oci8 -e "OCI8.new('cm','pass','databasename').exec('SELECT * FROM PLATFORMS');" it returns nothing from the database. I'm not getting any TNSListner errors. Not error messages what so ever, but no data either. HELP!!!

I had problems with the connection at first too. Here is what I am using:

development:   adapter: oci   host: 192.168.2.1/SID_NAME.world   username: userId1   password: password1

The host included not just the SID, but the entire oracle service name (that .world thing).

Thanks for the reply. I'll try it, but I don't think database.rb would make a difference if I'm running ruby from command line just to test the database connection. Any other ideas?

Hi,

No error message means you have connected to Oracle db successfully.

The following command will show the data you want:

ruby -r oci8 -e “OCI8.new(‘cm’,‘pass’,‘databasename’).exec(‘SELECT * FROM PLATFORMS’) do |r| puts r.join(‘,’); end

Wow this was confusing. i figured out that not only do you have to run the mswin.rb oracle adapter, but you also have to manually copy the oracle_adapter.rb to the proper activerecord directory (where all the other database adapters are located). Only with both of those things in place, can you run a ruby application over oracle. if you only install the mswin oracle adapter, you can only execute sql queries from ruby from command line without errors, but you won't be able to successfully run the generate script.

Anyway thanks for the reply. This problem was even sillier because I didn't understand the ruby language at the time and had no idea that "puts" was the same as printf, so I wasn't actually printing anything out :smiley: