Accessing PostgreSQL from windows NT with ODBC

From: "William McCracken" <will(at)sitestar(dot)com>
To: <pgsql-interfaces(at)postgresql(dot)org>
Subject: Accessing PostgreSQL from windows NT with ODBC
Date: 1998-08-06 16:03:34
Message-ID: 000f01bdc153$c3765380$1304e426@loopy.sitestar.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

I am accessing a postgres server running on a Linux box through
the postgres odbc driver for windows95/NT. I have my DSN set up
and am able to open my connection with Win32::ODBC. I can run a
simple query and retrieve the field names for the query but
cannot get any data out of the query. My ODBC logs say that the
query returned 83 records but Win32::ODBC says that it has 0. Here's
my script:

use Win32::ODBC;

if (!($O = new Win32::ODBC('PostgreSQL'))){
print "Failure. \n\n";
exit();
}else{
print "Success (connection #", $O->Connection(), ")\n\n";
}

if (! $O->Sql("SELECT * FROM cat_structure")) {

@FieldNames = $O->FieldNames();
foreach $FieldName (@FieldNames) {
print "$FieldName\n";
}

print "Number: ", $O->RowCount(), "\n";

while($O->FetchRow()) {
print "Trying first row\n\n";
undef %Data;
%Data = $O->DataHash();
print "$Data{'title'}\n";
}
}

$O->Close();

exit;
------------------------------
Here is what it returns:

Success (connection #1)

catid
title
sub_of
Number: 0
--------------------------------
And here is the log from windows ODBC:

conn=13437052, SQLDriverConnect( in)='DSN=PostgreSQL;',
fDriverCompletion=0
DSN info:
DSN='PostgreSQL',server='www.sitestar.com',port='5432',dbase='soccermall',us
er='',passwd=''

readonly='0',protocol='',showoid='0',fakeoidindex='0',showsystable='0'
conn_settings=''
translation_dll='',translation_option=''
conn=13437052,
SQLDriverConnect(out)='DSN=PostgreSQL;DATABASE=soccermall;SERVER=www.sitesta
r.com;PORT=5432;UID=will;PWD=;READONLY=0;PROTOCOL=;FAKEOIDINDEX=0;SHOWOIDCOL
UMN=0;ROWVERSIONING=0;SHOWSYSTEMTABLES=0;CONNSETTINGS='

Global Options: fetch=100, socket=4096, unknown_sizes=0,
max_varchar_size=254, max_longvarchar_size=4094
disable_optimizer=1, unique_index=0, use_declarefetch=1
text_as_longvarchar=1, unknowns_as_longvarchar=0,
bools_as_char=1
extra_systable_prefixes='dd_;', conn_settings=''
conn=13437052, query=' '
conn=13437052, query='BEGIN'
conn=13437052, query='set DateStyle to 'ISO'; set geqo to 'OFF''
Command response: 'SET VARIABLE'
conn=13437052, query='declare SQL_CUR13451544 cursor for select oid from
pg_type where typname='lo''
conn=13437052, query='fetch 100 in SQL_CUR13451544'
[ fetched 0 rows ]
conn=13437052, query='close SQL_CUR13451544'
conn=13437052, query='END'
conn=13437052, query='BEGIN'
conn=13437052, query='declare SQL_CUR13451544 cursor for SELECT * FROM
cat_structure'
conn=13437052, query='fetch 100 in SQL_CUR13451544'
[ fetched 83 rows ]
conn=13437052, query='close SQL_CUR13451544'
conn=13437052, query='END'
conn=13437052, SQLDisconnect

----------

Any help would be greatly appreciated.

Thanks,

Will McCracken

Browse pgsql-interfaces by date

  From Date Subject
Next Message Karl Bolingbroke 1998-08-06 16:05:44 Server-side cursors
Previous Message Bruce Momjian 1998-08-06 15:35:03 Re: [HACKERS] Large objects names