Thread: odbc with PostgreSQL 8.0 & Delphi

odbc with PostgreSQL 8.0 & Delphi

From
Melanie Bergeron
Date:
Hi all

I recently migrated to PostgreSQL 8.0 but I have now a problem acessing
database through Delphi with psql-odbc.  When I try to access any string
value, I always get an error (EDatabaseError).  My settings for the
DataSource are the following :

--------------------------------------
Disable Genetic Optimizer: on
KSQO : on
Recognize unique index : on
Text as LongVarChar : on
Unknown as LongVarChar : on
Bool as Char : on
Max VarChar: 254
Cache Size : 100
Max LongVarChar : 8190
SysTables Prefixes : dd_
LF <-> CRLF conversion : on
Updatable cursors: on
Int8 as : default
Protocol : 7.X, 6.4+
Anything else : off
--------------------------------------

Any hint on how I could resolve my problem would be really appreciated.

Thanks

Melanie



Re: odbc with PostgreSQL 8.0 & Delphi

From
"Gary Doades"
Date:
On 24 Sep 2004 at 10:57, Melanie Bergeron wrote:

> Hi all
>
> I recently migrated to PostgreSQL 8.0 but I have now a problem acessing
> database through Delphi with psql-odbc.  When I try to access any string
> value, I always get an error (EDatabaseError).  My settings for the
> DataSource are the following :
>
> --------------------------------------
> Disable Genetic Optimizer: on
> KSQO : on
> Recognize unique index : on
> Text as LongVarChar : on
> Unknown as LongVarChar : on
> Bool as Char : on
> Max VarChar: 254
> Cache Size : 100
> Max LongVarChar : 8190
> SysTables Prefixes : dd_
> LF <-> CRLF conversion : on
> Updatable cursors: on
> Int8 as : default
> Protocol : 7.X, 6.4+
> Anything else : off
> --------------------------------------
>

Looks like the default stuff. What version of the ODBC driver do you
have? Have you tried an ODBC trace? This would most likely tell you of
the driver had get any errors from the back-end and what ODBC
function call was involved in the error.

Failing that you could try the drivers own "mylog" trace output to see if
that helps.

Cheers,
Gary.


Re: odbc with PostgreSQL 8.0 & Delphi

From
Melanie Bergeron
Date:
Thanks for your reply Gary.  I have ODBC driver psqlodbc-07_03_0200.  I take a look at the mylog file and everything seems to work fine for the query:

...
[2364] Sending SELECT statement on stmt=47094344, cursor_name='SQL_CUR02CE9A48'
[2364]send_query(): conn=47071240, query='SELECT * FROM gec_user_view, gec_domain_view WHERE gec_domain_view.domain_showname = 'GEC' AND gec_domain_view.domain_id = gec_user_view.domain_id AND gec_user_view.login_name = 'mbergeron'
'
[2364]send_query: done sending query
[2364]in QR_Constructor
[2364]exit QR_Constructor
[2364]read 692, global_socket_buffersize=4096
[2364]send_query: got id = 'P'
[2364]send_query: got id = 'T'
[2364]QR_fetch_tuples: cursor = '', self->cursor=0
[2364]num_fields = 22
[2364]READING ATTTYPMOD
[2364]CI_read_fields: fieldname='user_id', adtid=23, adtsize=4, atttypmod=-1
[2364]READING ATTTYPMOD
[2364]CI_read_fields: fieldname='domain_id', adtid=23, adtsize=4, atttypmod=-1
[2364]READING ATTTYPMOD
[2364]CI_read_fields: fieldname='login_name', adtid=1043, adtsize=-1, atttypmod=60
[2364]READING ATTTYPMOD
[2364]CI_read_fields: fieldname='login_pass', adtid=1043, adtsize=-1, atttypmod=32
[2364]READING ATTTYPMOD
[2364]CI_read_fields: fieldname='first_name', adtid=25, adtsize=-1, atttypmod=-1
[2364]READING ATTTYPMOD
[2364]CI_read_fields: fieldname='last_name', adtid=25, adtsize=-1, atttypmod=-1
...
[2364]READING ATTTYPMOD
[2364]CI_read_fields: fieldname='bill_to_user', adtid=16, adtsize=1, atttypmod=-1
[2364]QR_fetch_tuples: past CI_read_fields: num_fields = 22
[2364]MALLOC: tuple_size = 100, size = 17600
[2364]next_tuple: inTuples = true, falling through: fcount = 101, fetch_count = 101
[2364]qresult: len=1, buffer='2'
[2364]qresult: len=1, buffer='1'
[2364]qresult: len=9, buffer='mbergeron'
[2364]qresult: len=32, buffer='01CFCD4F6B8770FEBFB40CB906715822'
[2364]qresult: len=7, buffer='Melanie'
[2364]qresult: len=8, buffer='Bergeron'

...

But when I am running under Delphi, I can't get any string field like first_name (Melanie); it returns EDatabaseError.  But when I read the log, I see that it was read!

Inside the file, I noticed only one error at the beginning of the 165-page file :
[4088]PGAPI_Connect: returning...
[4088][SQLGetDiagRecW][4088]PGAPI_GetDiagRec entering rec=1[4088]**** PGAPI_ConnectError: hdbc=47071240 <0>
[4088]enter CC_get_error
[4088]enter CC_create_errormsg
[4088]msg = ''
[4088]exit CC_create_errormsg
[4088]exit CC_get_error
[4088]CC_Get_error returned nothing.
[4088]PGAPI_GetDiagRec exiting 100

Any idea on what my problem could be??

Thanks,

Melanie

Re: odbc with PostgreSQL 8.0 & Delphi

From
"Gary Doades"
Date:
On 27 Sep 2004 at 9:18, Melanie Bergeron wrote:

>
> Thanks for your reply Gary. I have ODBC driver psqlodbc-07_03_0200. I
> take a look at the mylog file and everything seems to work fine for the
> query:
>
> Any idea on what my problem could be??
>
> Thanks,
>
>
> Melanie
>

Well on first glance it doesn't look like a postgres problem or ODBC driver problem. It
would still perhaps be useful to look at an ODBC trace log (from the ODBC driver
manager).

Looking at the Delphi documentation I have I see that EDatabaseError can cover many
sins. Is there no other message that goes with it?

What are the datatypes of the string columns you are trying to retrieve?

Cheers,
Gary.


Re: odbc with PostgreSQL 8.0 & Delphi

From
Richard Combs
Date:
If my memory serves me, this is a Delphi problem, and it depends on the connection tool you are using in Delphi to make the ODBC connection.  It's been a while since I've worked with Delphi, but I remember having the same issue with earlier versions of PGSql with this same ODBC driver.

Gary Doades wrote:
On 27 Sep 2004 at 9:18, Melanie Bergeron wrote:
 
Thanks for your reply Gary. I have ODBC driver psqlodbc-07_03_0200. I 
take a look at the mylog file and everything seems to work fine for the 
query: 

Any idea on what my problem could be??

Thanks,


Melanie 
   
Well on first glance it doesn't look like a postgres problem or ODBC driver problem. It 
would still perhaps be useful to look at an ODBC trace log (from the ODBC driver 
manager).

Looking at the Delphi documentation I have I see that EDatabaseError can cover many 
sins. Is there no other message that goes with it?

What are the datatypes of the string columns you are trying to retrieve?

Cheers,
Gary.


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


.