[plt-scheme] Advise debugging my srpersist connection (w/ postgres)

From: Francisco Solsona (solsona at acm.org)
Date: Tue Sep 10 11:02:27 EDT 2002

Richard Michael <rmichael at fields.utoronto.ca> writes:

> (lib-"srpersist.ss" "srpersist"))

I'm sure this is NOT the problem, but the above line should read:

(require (lib "srpersist.ss" "srpersist"))

> (define r-env-h (alloc-handle 'sql-handle-env))
> (define r-con-h (alloc-handle 'sql-handle-dbc r-env-h))
> (define r-stmt-h (alloc-handle 'sql-handle-stmt r-con-h))
> The last call to "alloc-handle" returns:
> "Unspecified error in alloc-handle".

What version of iODBC are you using? I've been testing with iODBC
3.0.5, and the support for ODBC 3+ seems to be broken.  I get the
exact same error.  However if I recompile SrPersist, and tell it is
using a 2.5 ODBC driver it works fine.

There is a new 3.0.6, that I haven't try, that might not present this
broken behavior, though.


> This is precisely the same error that was returned when I was debugging
> iODBC with their provided "odbtest" program.  To resolve it, I had to
> specify a very particular ODBC connect statement: 
> "dsn=PostgreSQL;server=localhost;post=5432;database=life;uid=postgres"

Do you have an odbc.ini file in a standard place? In my system that
place is /usr/local/etc, although I have an .odbc.ini in my home.
That file has important db, and driver information, and that is
probably why iODBC is sending you the SQL_NO_DATA errors.

> Can someone offer some debugging tips?

SrPersist raises different exceptions, so you can use `with-handlers'
to catch those, and see what your driver is returning.  See doc.txt in
the collects/srpersist directory for information on the different
kinds of exceptions.


Posted on the users mailing list.