Robert Twitty wrote:
On Thu, 19 Aug 2004, Gerard Samuel wrote:

Robert Twitty wrote:


Is anyone using PHP to connect to an IBM DB2 database?  The reason why I
am asking is becaouse I want to see if the odbtp extension can be used to
successfully prepare and execute DB2 stored procedures.  So far, ODBTP
performs quite well with IBM DB2 in regards to regular queries.

I've never used stored procedures before, but if you have example code on hand, I can give it a shot...

Unfortunately, I do not have access to an IDM DB2 database, so I don't have any examples of my own. However, after "Googling", I have discovered that creating DB2 stored procedures is a bit more complex than that of other databases, like SQL Server and Oracle. It appears that DB2 stored procedures are implemented as external shared libraries, i.e., DLLs. The examples that I found were written in C. So, testing ODBTP with DB2 stored procedures may be beyond the call of duty.

-- bob

Actually, DB2 has supported SQL procedures (following the SQL standard syntax for Persistent SQL Modules or PSM) since Version 7, but until Version 8.1 FixPak 7 (aka Version 8.2) you had to have a C compiler lurking under the covers -- which occasionally wound up in a configuration problem. There are lots of simple SQL procedure samples shipped in the sqllib/samples/sqlproc/ directory, or you can view them online at

With Version 8.1 FixPak 7 / Version 8.2 the requirement for a C compiler is lifted and you can simply issue a CREATE PROCEDURE statement to, well, create an SQL procedure. So testing should become a whole lot simpler.

You can get a free-for-development version of DB2 Personal Developer's Edition from if you want to test it out. Registration is required, but there's no license fee involved as long as you're not using the database in a production environment.


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to