This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ODBC with PostgreSQL


I'm a newbie to databases 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 the 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 });

Attachment: cygcheck.txt
Description: Text document

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]