FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-13-2010, 02:11 PM
Dino Vliet
 
Default access postgresql from ruby script

Dear debian list members,
I want to access a postgresql database server from within a ruby script and installed the following packages:

~$ dpkg -l | grep ruby
ii* libpgsql-ruby1.8******************** 0.7.9.2008.03.18-2******** PostgreSQL interface for Ruby 1.8
ii* libruby1.8************************** 1.8.7.72-3lenny1********** Libraries necessary to run Ruby 1.8
ii*
ruby******************************** 4.2*********************** An interpreter of object-oriented scripting language Ruby
ii* ruby1.8***************************** 1.8.7.72-3lenny1********** Interpreter of object-oriented scripting language Ruby 1.8

My script looks like this:

#!/usr/bin/ruby
require "postgres"

* puts "Starting................"
* dbname="abc"
* start="2004-08-06"
* end="2004-10-14"
*#make connection
*
conn = PGconn.connect("localhost",5432,"","",dbname,"user ","password")

However, I get the following error:

maakklassen.rb:9:in `require': no such file to load -- postgres (LoadError)
******* from maakklassen.rb:9

My postgresql related packages are:
dpkg -l | grep postgres
ii* postgresql************************** 8.3.11-0lenny1************ object-relational SQL database (supported version)
ii* postgresql-8.3********************** 8.3.11-0lenny1************ object-relational SQL database, version 8.3 server
ii*
postgresql-client******************* 8.3.11-0lenny1************ front-end programs for PostgreSQL (supported version)
ii* postgresql-client-8.3*************** 8.3.11-0lenny1************ front-end programs for PostgreSQL 8.3
ii* postgresql-client-common************ 94lenny1****************** manager for multiple PostgreSQL client versions
ii* postgresql-common*******************
94lenny1****************** PostgreSQL database-cluster manager
ii* postgresql-contrib****************** 8.3.11-0lenny1************ additional facilities for PostgreSQL (supported version)
ii* postgresql-contrib-8.3************** 8.3.11-0lenny1************ additional facilities for PostgreSQL
ii* postgresql-doc********************** 8.3.11-0lenny1************ documentation for the PostgreSQL database
management system
ii* postgresql-doc-8.3****************** 8.3.11-0lenny1************ documentation for the PostgreSQL database management system


What am I doing wrong here?

Brgds
Dino
 
Old 07-14-2010, 04:31 AM
Nick
 
Default access postgresql from ruby script

On 2010-07-13 07:11, Dino Vliet wrote:
> ~$ dpkg -l | grep ruby
> ii libpgsql-ruby1.8 0.7.9.2008.03.18-2 PostgreSQL

> maakklassen.rb:9:in `require': no such file to load -- postgres
> (LoadError) from maakklassen.rb:9

> What am I doing wrong here?

Try "require 'pg'" instead of "require 'postgres'".

--
Nick


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100714043155.GC2730@acrasis.net">http://lists.debian.org/20100714043155.GC2730@acrasis.net
 

Thread Tools




All times are GMT. The time now is 07:27 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org