From: Dino Vliet on
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







From: Nick on
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(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/20100714043155.GC2730(a)acrasis.net
 | 
Pages: 1
Prev: Problem with apt-get --
Next: Versions of Debian