# How can i connet the postgersql with ruby

**URL:** <https://www.ruby-forum.com/t/how-can-i-connet-the-postgersql-with-ruby/117467>\
**Category:** Ruby\
**Created:** [October 17, 2007, 7:52am UTC](https://www.ruby-forum.com/t/how-can-i-connet-the-postgersql-with-ruby/117467 "2007-10-17T07:52:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vellingiri](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/5fc32e/32.png) [@vellingiri](https://www.ruby-forum.com/u/vellingiri)\
**Post date:** [October 17, 2007, 7:52am UTC](https://www.ruby-forum.com/t/how-can-i-connet-the-postgersql-with-ruby/117467/1 "2007-10-17T07:52:13Z")

</div>

Dear friends,  
Actually,I am having the lot of table in postgres.  
But i need to access the table using the ruby.How could i access that  
file.  
how can i connet the postgersql with ruby.Plese any one tell to me.

by  
vellingiri

---

<div class="post-metadata">

**Author:** ![vellingiri](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/5fc32e/32.png) [@vellingiri](https://www.ruby-forum.com/u/vellingiri)\
**Post date:** [October 17, 2007, 10:35am UTC](https://www.ruby-forum.com/t/how-can-i-connet-the-postgersql-with-ruby/117467/2 "2007-10-17T10:35:32Z")

</div>

Vellingiri A. wrote:

> Dear friends,  
> Actually,I am having the lot of table in postgres.  
> But i need to access the table using the ruby.How could i access that  
> file.  
> how can i connet the postgersql with ruby.Plese any one tell to me.
> 
> by  
> vellingiri

Dear Friends,  
As per my mail I myself took risk to findout the answers.  
For example,  
I am having the postgresql table,In that I am having lot of table.  
I want to access the particular inforamtion.  
How we could do?  
solution is here:  
require ‘postgres’  
conn=PGconn.connect(“fountserver”,5432,’’,’’,“vellingiri”,“vellingiri”,“vellingiri”)  
res=conn.exec(‘select \* from birthday’)  
res.each do |row|  
row.each do |column|  
print column  
(20-column.length).times{print " "}  
end  
puts  
end

Note:other than that If it is there anything please tell me .  
by  
vellingiri

---

<div class="post-metadata">

**Author:** ![vellingiri](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/5fc32e/32.png) [@vellingiri](https://www.ruby-forum.com/u/vellingiri)\
**Post date:** [October 17, 2007, 2:08pm UTC](https://www.ruby-forum.com/t/how-can-i-connet-the-postgersql-with-ruby/117467/3 "2007-10-17T14:08:16Z")

</div>

On 10/17/07, Vellingiri A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Note:other than that If it is there anything please tell me .  
> by  
> vellingiri

Vellingiri,

If you are not using an ORM, this is the proper idea for directly  
interfacing.

Best wishes,  
~Wayne
