Thread: RE: RE: RE: tourble migrating from linux/Apache/postgres ql/perl to win2000/IIS/postgresql/perl
RE: RE: RE: tourble migrating from linux/Apache/postgres ql/perl to win2000/IIS/postgresql/perl
From
Rishi Sharma
Date:
Just wondering if I need to install ODBC? CGI will not need ODBC correct? -----Original Message----- From: Rishi Sharma To: 's0lao@netscape.net '; Rishi Sharma Cc: 'Jason.Tishler@dothill.com '; 'pgsql-cygwin@postgresql.org ' Sent: 6/13/01 9:16 PM Subject: RE: RE: [CYGWIN] RE: tourble migrating from linux/Apache/postgresql/perl to win2000/IIS/postgresql/perl Dear Slao, Thanks for the explanation. I figured out what was casuing my make to fail. Solution: move the cygwin/bin before winnt;winnt/system32 in the PATH variable. I recommend adding a note at the bottom of http://people.freebsd.org/~kevlo/postgres/portNT.html. progress: I was able to build the postgres7.1.2-1 source and also build the Pg.pm module (thanks Slao). Evertyhing works in a windows shell...I can run my simple test script and query the database properly: test script: #use Pg; # #$conn = Pg::connectdb("dbname=intake"); # #$status=$conn->status; #if ($status != PGRES_CONNECTION_OK) { # print STDERR "fatal error ($status), terminated\n"; # exit (1); #} # # Pg::doQuery($conn, " select * from tbl_checklist", \@arreglo); # foreach my $i (0 .. $#arreglo) { # foreach my $j (0 .. $#{$arreglo[$i]}) { # print "$arreglo[$i][$j]\t"; # } # print "\n"; # } #exit (0); result from test in shell: 200005100000 121 200005100000 122 200005100000 123 200005100000 124 200005100000 128 200005100000 129 200005100000 130 200005100000 131 200005100000 132 200005100000 133 200005100000 134 GREAT!!! Now I need to figure out how to do this in a CGI ... my cgi seems to be hanging again where I say "use Pg;". The browser just waits there until the cgi times out. I don't think Pg is being loaded properly. here is the CGI: #!/usr/bin/perl use Pg; use CGI qw(:standard); print header; print start_html('A PostgresSQL Example'), h1('A PostgresSQL Examplee2'), start_form, "SQL: select * from tbl_checklist", p, submit, end_form, hr; #$conn = Pg::connectdb("dbname=intake"); $conn = Pg::new('','','','','intake'); $status=$conn->status; if ($status != PGRES_CONNECTION_OK) { print STDERR "Error fatal en la conexion ($status), terminamos\n"; exit (1); } $sql = "select * from tbl_checklist"; $result = $conn->exec($sql); $t = '1'; $html3 = $t; $align = $t; $header = $t; $tableOpt = 'Border'; $result->print(stdout, $header, $align, $standard, $html3, $expanded, $pager, $fieldSep, $tableOpt, $caption); print end_html; exit; -----Original Message----- From: s0lao@netscape.net To: rsharma@bigstep.net Cc: s0lao@netscape.net; Jason.Tishler@dothill.com; pgsql-cygwin@postgresql.org Sent: 6/11/01 10:29 PM Subject: Re: RE: [CYGWIN] RE: tourble migrating from linux/Apache/postgresql/perl to win2000/IIS/postgresql/perl Rishi Sharma <rsharma@Bigstep.net> wrote: > > SLao, > > Let me try to clarify...the perl scripts try to load the Pg.pm module by > stating "use Pg". You say this should be a binary file? I found a few > copies of Pg.pm under .../perl/src or something like that, but it was ascii > text, I didn't dig too deep in to what it was doing. > Ok, then it's clear your scripts are using the Pg driver bundled with PostgreSQL. > > I've found this http://www.edmund-mergl.de/export/DBD-Pg.zip from > symbolstone (http://dbi.symbolstone.org/cgi/moduledump?module=DBD::Pg)... > hopefully it's all I need. > From the point the above affirmation was made, any reference to DBI/DBD drivers becomes redundant. If your scripts use the Pg driver, migrating to DBI/DBD::Pg driver could be difficult, as they should be (quite some more than) batch changed. > > If I install postgresql-7.1.2 from Jason and drop in the libpq.dll and > Pg.dll in my winnt/system32 should I be able to access my database from cgi > scripts with simply stating "use Pg"?? > > There seems to be something missing here... > Maybe yet another comment :) You must not forget to place Pg.pm somewhere so that Perl is able to find it. I think the layout with libpq.dll and pg.dll in winnt/system32 is viable. But, anyway, for any eventual problems, here's what "make install" in "src/interfaces/perl" produces: $ ls -lR /usr/local/lib/perl5/site_perl/5.6.0/cygwin/ total 9 -r--r--r-- 1 lao 544 18124 Sep 27 1998 Pg.pm drwxr-xr-x 3 lao 544 0 Jun 11 08:57 auto /usr/local/lib/perl5/site_perl/5.6.0/cygwin/auto: total 0 drwxr-xr-x 2 lao 544 0 Jun 11 08:57 Pg /usr/local/lib/perl5/site_perl/5.6.0/cygwin/auto/Pg: total 83 -r--r--r-- 1 lao 544 0 Jun 11 08:57 Pg.bs -r-xr-xr-x 1 lao 544 73728 Jun 11 08:57 Pg.dll -r--r--r-- 1 lao 544 81 Jun 11 08:57 autosplit.ix -r--r--r-- 1 lao 544 93106 Jun 11 08:57 libPg.a I think that a link to winnt/system32/Pg.dll in /usr/local/lib/perl5/site_perl/5.6.0/cygwin/auto/Pg could solve any (eventual) Perl instalation issues. Good luck! SLao __________________________________________________________________ Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/
Re: RE: RE: RE: tourble migrating from linux/Apache/postgresql/perl to win2000/IIS/postgresql/perl
From
s0lao@netscape.net (S. L.)
Date:
Rishi Sharma <rsharma@Bigstep.net> wrote: > > Just wondering if I need to install ODBC? > > CGI will not need ODBC correct? > To quote from README in src/interfaces/perl5: "This has been done by using the Perl5 application programming interface for C extensions which calls the Postgres programmer'sinterface LIBPQ." It's nothing mentioned about ODBC, and it shouldn't, as ODBC is also based on LIBPQ. The bottom line is you don't need ODBC. You need ODBC only for ODBC calls in your applications or for ODBC based applications. A few hints about your CGI problem: 1. Are you sure you use perl distribution included with cygwin ? (you posted a message where your @INC pointed to some d:/Perl/[...]paths) 2. If you use the ActivePerl distribution I'm quite curious how's that my Pg.dll worked in your perl -w. 3. If your perl is located in d:/Perl/bin/perl.exe, then so should the #! line of your scripts, i.e. #!d:/Perl/bin/perl.exe. 4. If you have 2 versions of perl installed (the ActivePerl and the cygwin one), you should be careful that your scriptsget a sane environment for the one they use (as it happened with your PostgreSQL building attempts). 5. I'd recommend that your scripts use only the cygwin version of perl -- with a proper MIME configured (i.e. for .pl files,the server should execute d:/cygwin/usr/local/bin/perl.exe rather than d:/Perl/bin/perl); at least those scripts thatuse the Pg driver. SLao __________________________________________________________________ Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/