Perl_ODBC access of 6.4.2 - Mailing list pgsql-interfaces
From | George Henry C. Daswani |
---|---|
Subject | Perl_ODBC access of 6.4.2 |
Date | |
Msg-id | 008501beaf90$a74ac840$0a01a8c0@portalworks.com Whole thread Raw |
List | pgsql-interfaces |
Hello, I've done so.. My devel box is RedHat Linux 6.0 and I used iodbc from http://www.openlinksw.com/iodbc - downloaded source and compiled it using configure --prefix=/opt/iodbc --with-iodbc-inidir=/etc make ; make install logged in as user postgres with a home dir of /opt/pgsql then I downloaded the latest postgresql 6.5 snapshot from ftp.postgresql.org untar-gzipped it (pgsql) grabbed http://www.insightdist.com/psqlodbc/latest/postsrc.zip and unzipped it's contents to pgsq/src/interfaces/odbc then did a configure --prefix=/opt/pgsql --with-odbc --with-odbcinst=/opt/pgsql make ; make install logged in as root added "/opt/iodbc/lib" to my /etc/ld.so.conf and "/opt/pgsql/lib" to my /etc/ld.so.conf did an ldconfig -v added the following to my /etc/profile.d directory with 755 permisions root:root ----------- postgresql.sh --------------------- #!/bin/sh PGDIR=/opt/pgsql PGLIB=${PGDIR}/lib PGDATA=${PGDIR}/data export PGLIB PGDATA echo ${PATH} | grep -e "${PGDIR}/bin" > /dev/null 2>&1 if [ "$?" -eq "1" ] ; then PATH=$PATH:${PGDIR}/bin export PATH fi echo ${LD_LIBRARY_PATH} | grep -e "${PGDIR}/lib" > /dev/null 2>&1 if [ "$?" -eq "1" ] ; then LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PGDIR}/lib export LD_LIBRARY_PATH fi echo ${MANPATH} | grep -e "${PGDIR}/man" > /dev/null 2>&1 if [ "$?" -eq "1" ] ; then MANPATH=${MANPATH}:${PGDIR}/man export MANPATH fi ------------------------ CUT HERE --------------------------- create an ~/odbc.ini file containing [DataSources] template1 = Template Database [template1] Description = Template Database on PostgreSQL Server Centauri Driver = /opt/pgsql/lib/libpsqlodbc.so Servername = centauri Port = 5432 Database = template1 Protocol = 6.4 ReadOnly = Off ------------------------------------------- logged in as a postgres user then made sure postmaster was started with the -i option, and the pg_hba.conf allowed connections from my subnet host all 207.137.42.0 255.255.255.0 password then did psql template1 alter user postgres with password "pick.your.own.password"; quit logged in as root ftp'd DBI-1.08 did a perl Makefile.PL ftp'd DBD-ODBD-0.20 export DBI_DSN="dbi:ODBC:template1" export DBI_USER="postgres" export DBI_PASS="pick.your.own.password" did a "perl Makefile.PL -o /opt/iodbc" vi'd Makefile and appended -L/opt/iodbc/lib -liodbc to "LDDFLAGS" and appended -I/opt/iodbc/include to "INC" vi'd the file "dbdodbc.h" and changed #include <sql.h> -> <isql.h> #include <sqlext.h> -> <isqlext.h> did a "make ; make test (one test will fail) then ; make install" wala, was able to use DBD-ODBC with postgresql.. Just make sure your ~/.odbc.ini is setup correctly ( the current *.ini parsing function GetPrivateProfileString IS EXTREMELY BUGGY! so if it core's it's just that blasted Function call - i'm planning on ripping the iodbc ini parsing functions and replacing GetPrivateProfileString with it ) and that postmaster on the server allows socket connections and that a password has been set on the user account or db you are trying to connect to.. *NOTE* I also tried unixODBC 1.04 from http://www.genix.net/unixODBC and used the postgres odbc driver that came with it, it coredumps on the perl DBD:ODBC make test so I didn't want to use it.. I also compiled these packages on solaris x86 2.7 - compiles okay and somehow works, but it's also coredumps from time to time - seems to be alot more stable on linux.. George Daswani ------------------ - ORIGINAL --------------------------------------- (Yes, I know that there is a DBD/DBI interface for Postgres, but the project spec says ODBC) I have a client that wants me to program perl code using ODBC for data access. And the target database to talk to is PostgreSQL 6.4.2 Has anyone ever gotten DBD-ODBC-0.20 to interface with PostgreSQL?
pgsql-interfaces by date: