Re: Source name not found

From: Mike G <mike(at)thegodshalls(dot)com>
To: Barry <mail(at)polisource(dot)com>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: Source name not found
Date: 2004-06-13 19:05:03
Message-ID: 20040613190503.GA6183@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin

Hi,

I believe if you do perl nameoffile it executes cygwin perl.
If you do just nameofofile.pl then activestate perl is used.

In cygwin the perl module is named DBD:Pg.
In activestate the same perl module is named DBD::PgPP.

DSN should be replaced with the name of odbc connection you created in your DBI connect statement.

If you used the default when creating the odbc in the control panel->data sources I believe it is named Postgresql.

I used both cygwin and activestate perl on XP and done't have any problems connecting.

I don't have my work pc running at the moment but I don't believe I reference the Perl ODBC module in my scripts. Just the Pg modules.

You can run CPAN from within a cygwin shell and install Perl modules for cygwin just as you would for activestate.

There is also a postgresql odbc driver for windows that can be downloaded off the gborg site.

HTH.

Mike

On Sun, Jun 13, 2004 at 12:59:25PM -0400, Barry wrote:
> I'm a newbie to PostgreSQL and cygwin, and I'm having a problem with ODBC.
>
> When I paste the path of the below script to Cygwin, to connect to a
> database using Perl's DBD::PgPP module, it seems to work because I get no
> error message, but when I comment-out the $dsn definition that uses PgPP
> and uncomment any of the other $dsn definitions, which use ODBC, I recieve
> the error:
>
> "DBI connect('DSN','postgres',...) failed: [Microsoft][ODBC Driver
> Manager] Data source name not found and no default driver specified
> (SQL-IM002)(DBD: db_login/SQLConnect err=-1) at [file name] line 14"
>
> I don't expect the code to do anything useful. I'm just getting started
> with PostgreSQL and I wanted to test what little I learned so far.
>
> At http://testers.cpan.org/show/DBD-ODBC.html it says that the latest
> DBD::ODBC versions fail for Windows, but I know that ActiveState's version
> passes. I have ActivePerl installed along with Cygwin's Perl. When I
> configured ActivePerl, I had .pl files be associated with it, and I'm not
> sure what Perl is used when I paste "perl <path>" in Cygwin, or if there's
> a conflict, or if my error is caused by Cygwin's version of DBD::ODBC not
> working for Windows XP.
>
> My search for DBD::ODBC using Cygwin's mailing list search tool returned
> nothing, but searching Google got me the following Q and A from
> http://www.cygwin.com/ml/cygwin/2001-08/msg00254.html:
>
> >> Is there any pre-build perl modules for the perl in Cygwin?
> Particularly DBD::Mysql, DBD::ODBC.
>
> > No need for them to be pre-built. Get them from CPAN. Have a look at the
> DBI mail list archives or these mail archives for any further
> information.
>
> I have a feeling that information is out of date. Do I have to build
> DBD::ODBC?
>
> Thanks,
> Barry
>
> ---------------------------------------------
>
> use DBI;
> #
> #
> #
> $user = 'postgres';
> $password = 'omitted';
>
> ###$dsn = 'dbi:ODBC:DSN';
> ###$dsn = 'dbi:ODBC:dbname=template1';
> ###$dsn = 'dbi:ODBC:dbname=template1;host=localhost';
>
> $dsn = 'dbi:PgPP:dbname=template1;host=localhost';
>
> $dbh = DBI->connect($dsn, $user, $password, { RaiseError => 1, AutoCommit
> => 0 });
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match

In response to

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message David P. Lurie 2004-06-13 21:37:05 Re: Updated Cygwin Package: postgresql-7.4.2-1
Previous Message Barry 2004-06-13 16:59:25 Source name not found