Rails and PostgreSQL ???

Hi every one
How are you?

after a days and searching in forums i still can not find some things
that helping me
to connect Rails with postgre SQL of course those are helpful but not
for a stupid person like
me :smiley:

So i need my friends helping me here and advice me to how can i connect
this two things (ROR and Postgre Sql)
I need your help so much
My eyes going blind because of searching and looking at monitor. :frowning:
Please Help me.
S.O.S

there is some details about my system ==>

=> I have MS Windows Xp on my desktop
=> I installed ruby 1.9.1-p378
=> I installed rail 2.3.5
=> I installed PostgreSql 8.4

I am a newbie in ROR so please advice me step by step PLEASE. :slight_smile:

Thanks and Thanks and Thanks so much

Amir Sanaii wrote:

Hi every one
How are you?

after a days and searching in forums i still can not find some things
that helping me
to connect Rails with postgre SQL of course those are helpful but not
for a stupid person like
me :smiley:

So i need my friends helping me here and advice me to how can i connect
this two things (ROR and Postgre Sql)
I need your help so much
My eyes going blind because of searching and looking at monitor. :frowning:
Please Help me.
S.O.S

Well, you'd get better help if you told us what you'd already tried and
what didn't work (with error messages as applicable).

there is some details about my system ==>

=> I have MS Windows Xp on my desktop
=> I installed ruby 1.9.1-p378
=> I installed rail 2.3.5
=> I installed PostgreSql 8.4

I am a newbie in ROR so please advice me step by step PLEASE. :slight_smile:

Have you installed any of the gems for connecting Ruby with Postgres
(such as postgres or pg)? Without these gems, Ruby can't talk to the
DB.

Thanks and Thanks and Thanks so much

-----------------

Best Regards
Amir

Best,

I had same problem… but i use ubuntu 9.04… i had configure my postgresql look at this blog(it’s in pt-br)http://chevitarese.wordpress.com/2009/05/18/postgresql-ubuntu-9-04/ i think the configured is same … XD

Please post database.yml file and any errors in development.log. It
does work fine, postgres is my fav database for AR

Carina Brito wrote:

I had same problem... but i use ubuntu 9.04... i had configure my
postgresql
look at this blog(it's in pt-br)
http://chevitarese.wordpress.com/2009/05/18/postgresql-ubuntu-9-04/ i
think
the configured is same ... XD

Thanks to all
thank you my friend Marnen Laibow-Koser

I solved my problem with your advice and of course my god help :slight_smile:
I had problem on three things :

first => my pgadmin ;i mean i didn't set my pgAdmin's username in
database.Yml as user name

second => I have two version for ruby so errors comes out one after
another

third => I set the wrong gem install for postgreSql

special thanks to my friend Carina Brito for his help :slight_smile:
thank you man :slight_smile:

=^.^=…Your welcome… but… i’m a woman… XD… i’m not man heheh

another question ? =>

Can we have and use different DBMS install gem on one machine ?
for example : gem install sqlite-3 and gem install mysql and gem install
... and use one of them for each project i mean one project use MS SQL
SERVER and another one
use postgreSQL in the same time?

I am so sorry
please forgive me because my fault :frowning:

thank you my friend (I think this is better sentence) :smiley:

Yes, just put the appropriate setting in database.yml. You can even
have different drivers between production and development on the same
app.

Colin

chris wrote:

Please post database.yml file and any errors in development.log. It
does work fine, postgres is my fav database for AR

production:
  adapter: postgresql
  database: myportal
  username: usr
  password: pwd
  host: myhost

development:
   adapter: sqlite3
   database: db/development.sqlite
   timeout: 5000
   charset: UTF8

test:
   adapter: sqlite3
   database: db/test.sqlite
   timeout: 5000
   charset: UTF8

oracle:
  adapter: oracle
  database: srv/instance
  username: usr
  password: pwd
  encoding: utf8

This is my database.yml. I use sqlite for test and development and
postgres in production for my main db. I also need data from some tables
located in oracle.

Here is how you write model for table in oracle db:

class Ora_client < ActiveRecord::Base
  establish_connection(:oracle)
  set_table_name "klients_table"
end