[plt-scheme] Advise debugging my srpersist connection (w/ postgres)
I would love to see an "odbc.ini" and "odbcinst.ini" file from someone who has managed to get ODBC working with PostgreSQL. I have spent a few fruitless hours trying to connect to the database, and can't do so (even using the odbctest program from iODBC.)
Here's what I have in my file:
;
; odbc.ini
;
[ODBC Data Sources]
Test = A test database
[MainPostgreSQL]
Description = PostgreSQL-template1
Driver = /usr/lib/postgresql/lib/libodbcpsql.so.0.27
Trace = No
TraceFile = /var/log/odbc.log
Database = template1
Servername = localhost
UserName =
Password =
Port = 5432
Protocol = 6.4
ReadOnly = Yes
RowVersioning = No
ShowSystemTables = No
ShowOidColumn = No
FakeOidIndex = No
ConnSettings =
[Test]
Driver = /usr/lib/postgresql/lib/libodbcpsql.so.0.27
Database = test1
[Default]
Driver = /usr/lib/postgresql/lib/libodbcpsql.so.0.27
Server = localhost
[ODBC]
InstallDir = /usr/lib/odbc
Even with this file I have to use a string like:
DSN=test;server=localhost;database=test1;uid=bfulgham
I can omit the DSN name, but nothing else.
Something seems very wrong with this...
-Brent
-----Original Message-----
From: Francisco Solsona [mailto:solsona at acm.org]
Sent: Tue 9/10/2002 8:02 AM
To: Richard Michael
Cc: PLT Scheme mailing list
Subject: Re: [plt-scheme] Advise debugging my srpersist connection (w/ postgres)
For list-related administrative tasks:
http://list.cs.brown.edu/mailman/listinfo/plt-scheme
Richard Michael <rmichael at fields.utoronto.ca> writes:
Hi,
> (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.
--Francisco