[plt-scheme] No ODBC for DrScheme?

From: Noel Welsh (noelwelsh at gmail.com)
Date: Fri Jul 17 10:12:09 EDT 2009

If you haven't found the MSDN docs, they are here:


You will need to get hold of the ODBC header files.

You want to define the basic data structures in ODBC (handles and so
on). These are mostly, I think, opaque values so you can just use
_cpointer as a first pass.  Then get hold of the obdc library and
start defining functions. Test every step of the way, 'cause if you
make an error it will be very difficult to debug otherwise.

Here's a basic outline (untested):

(require scheme/foreign)

(define-cpointer-type _SQLHENV)
; etc ... You need SQLRETURN and friends. See sqltypes.h

(define libodbc (ffi-lib "libodbc"))

;; Start defining functions


;     SQLSMALLINT     HandleType,
;     SQLHANDLE     InputHandle,
;     SQLHANDLE *     OutputHandlePtr)

(define SQLAllocHandle

On Fri, Jul 17, 2009 at 7:05 AM, misterlight<mister.light at gmail.com> wrote:
> I started reading the documentation and found the appropriate DLL on
> my pc. Supposing that I'd like to try it, since I have no experience
> at all with FFI, are there some "standard steps" that you suggest to
> follow?
> Kind regards,
> ml

Posted on the users mailing list.