Thank you Corion for pointing me in the right direction. I have finally solved the problem which was a combination of lack of PostgreSQL ODBC driver and improper format of connection string.
Solution
Remark: I recommend using DBD::ODBC to connect to PostgreSQL on Windows instead of DBD::PgPP (unmaintained and full of bugs, written in Pure Perl) or DBD::Pg (no Windows version on ppm & latest update on http://pgfoundry.org/frs/?group_id=1000199&release_id=1212 is for Perl 5.10 made in late 2008).
1. Install latest version of DBI & DBD-ODBC using ppm.
2. Download & install appropriate psqlodbc driver from http://www.postgresql.org/ftp/odbc/versions/msi/ (don't forget to upgrade using the batch file).
3. Go to Control Panel -> Administrative Tools. Choose Data Sources shortcut. In the ODBC Data Source Administrator dialog box, click Add, then select the driver (e.g.: PostgreSQL Unicode) you want from the Installed ODBC Drivers list and choose OK.
4. Use the appropriate connection string (http://connectionstrings.com/postgre-sql#p51), e.g.:
5. Using telepathy, thank the person who compiled this little manual for you so that you don't have to go through the cycle of frustration, disillusionment and apathy.my $dbh = DBI->connect("dbi:ODBC:driver={PostgreSQL Unicode};Server=12 +7.0.0.1;Port=5432;Database=database;Uid=username;Pwd=password;", user +name, password, {PrintError => 1, RaiseError => 1}) || die "Error $DB +I::err [$DBI::errstr]";
In reply to Re: Cannot connect Perl to PostgreSQL using ODBC (SQL-IM002)
by lr3p
in thread Cannot connect Perl to PostgreSQL using ODBC (SQL-IM002)
by lr3p
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |