nuttaponp

  • Home
  • Categories
    • Music
    • Fashion
    • Lifestyle
    • Travel
  • About
  • Contact

Instagram

Instagram has returned invalid data.

Popular Posts

Lifestyle,

Hello My New Blog

by nuttaponpApril 25, 2016no comment
Fuze Card รวมทุกบัตร ไว้ในบัตรใบเดียว
Lifestyle,

Fuze Card รวมทุกบัตร ไว้ในบัตรใบเดียว

by nuttaponpAugust 19, 2017no comment
การตลาดผ่านสังคมออนไลน์ มีประโยชน์อย่างไร
Lifestyle,

การตลาดผ่านสังคมออนไลน์ มีประโยชน์อย่างไร

by nuttaponpSeptember 2, 2017no comment
The Adjustable Bag กระเป๋ายืดได้ หดได้
Lifestyle, Travel,

The Adjustable Bag กระเป๋ายืดได้ หดได้

by nuttaponpJuly 13, 2017no comment

Follow Us

nuttaponp

  • Home
  • Categories
    • Music
    • Fashion
    • Lifestyle
    • Travel
  • About
  • Contact
Testing,

Ruby connects to PostgreSQL

by nuttaponpMay 17, 2016no comment
0
Shares
Share on FacebookShare on Twitter

Here is a simple Ruby code to connect to PostgreSQL.

gem 'pg'
require 'pg'
 
conn = PG::Connection.open(:dbname => 'test')
res  = conn.exec('SELECT * from table1')
res.each do |row|
  row.each do |column|
    puts column
  end
end
p conn
conn.close

If you look deep in PG::Connection library, it contains 7 parameters which you can use just some of them or all of them. Then you can execute your query by the following command.

Note: Your PostgreSQL should have a role set to your database.

CONNECT_ARGUMENT_ORDER = %w[host port options tty dbname user password]
Previous

Hello My New Blog

April 25, 2016
Next

เว็บไซต์ สำคัญต่อธุรกิจของคุณอย่างไร!

June 6, 2016

nuttaponp

He is also a Blogger, Bookworm, Adventurous Traveler and Coffee Lover. Nuttapon's passion is about innovating test engineering methodologies and designing solutions to overall simplify product testing.

Leave a Reply Cancel reply

Related posts

3D652185-9117-46BF-AF98-37D6FC3A4052
Lifestyle, Testing,

Selenium WebDriver API เวอร์ชั่น 3.6.0 จะไม่รองรับ PhantomJS Headless

by nuttaponpOctober 21, 2017no comment

About me

He is also a Blogger, Bookworm, Adventurous Traveler and Coffee Lover.

Nuttapon’s passion is about innovating test engineering methodologies and designing solutions to overall simplify product testing.

Trending

  • Selenium WebDriver API เวอร์ชั่น 3.6.0 จะไม่รองรับ PhantomJS Headless

    Selenium WebDriver API เวอร์ชั่น 3.6.0 จะไม่รองรับ PhantomJS Headless

    October 21, 2017
  • Acteon Compression Packing Cubes ช่วยลดพื้นที่ สำหรับเสื้อผ้าใช้แล้ว

    Acteon Compression Packing Cubes ช่วยลดพื้นที่ สำหรับเสื้อผ้าใช้แล้ว

    September 16, 2017
  • การตลาดผ่านสังคมออนไลน์ มีประโยชน์อย่างไร

    การตลาดผ่านสังคมออนไลน์ มีประโยชน์อย่างไร

    September 2, 2017
  • Fuze Card รวมทุกบัตร ไว้ในบัตรใบเดียว

    Fuze Card รวมทุกบัตร ไว้ในบัตรใบเดียว

    August 19, 2017

Follow Us

Instagram

Instagram has returned invalid data.

© 2017 nuttaponp. All rights reserved.