Re: Getting DB2 Connectivity

Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> Tue, 28 Feb 2006 09:00:25 -0700
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
Harold Lee wrote:
> To begin with, let me say that I know DB2 is not supported. I'm  
> curious if the work on DB2 is ongoing, or stalled (maybe waiting for  
> a developer to help?).

I started work on the DB2 backend a few years ago. But stopped working
on it when I saw the semantics for DB2 were very close to ODBC. Based
on that, I thought that there wouldn't be a big overhead using ODBC to
access DB2 since the ODBC library for DB2 is likely a thin wrapper.

> I found that I could connect if I change the code in db2-sql.lisp for  
> DB2-CONNECT to use nil instead of SQL_NULL_HANDLE (which slime says  
> evaluates to 0). The problem is that DB2 defines SQL_NULL_HANDLE as 0  
> in the C header file sqlcli.h but DB2 is expecting a NULL pointer as  
> the input handle to sql-alloc-handle. Since 0 and nil are different  
> in Lisp, maybe you want to change the definition of SQL_NULL_HANDLE  
> in db2-constants.lisp to be nil instead.

Yes, that's a reasonable change.

> Here's the output from DB2 verifying that I got connected:

Very good.

> From there it looks like most of the functionality is missing, such  
> as methods for the generic functions database-query and database- 
> execute-command. Also, there is a lot less code in the DB2  
> subdirectory than in the MySQL directory.

Yes, other functionality has not been written given my thoughts that
the potential benefit was likely low.

> Should I provide more feedback as I make progress?

If you'd like to finish the DB2 interface, I'd be glad to add your
code to CLSQL. Currently, I don't have a DB2 system for testing,
though. So, I'd end up accepting your DB2 patches as untested.

-- 
Kevin Rosenberg
[email protected]