after 4 days (!?) development, DB2 driver for D6 is now ready for testing. it take IBM's D5 DB2 implementation as base reference, and reuse almost all D6 oracle driver (http://drupal.org/node/39260) special handling for overcoming DB2-specific limitations.

DB2-specific limitations includes:

  1. map "text:big" to "VARCHAR(4000)", as like as oracle driver's handling. this is all due to DB2 max table space limitation, even it can support for max. 32672 characters for VARCHAR.
  2. BLOB/CLOB also require special handling for INSERT/UPDATE query (so reuse LOBs patch's hook). even DB2 allow direct insert of BLOB/CLOB within query body, it will easy to be oversize when inserting a huge block of contect (e.g. menu cache contant 140K of characters, which will cause error when INSERT/UPDATE). again, similar handling as oracle driver
  3. once again, we don't have perfect db_num_rows() implementation within DB2, so just simply forget about it. it will reuse the progress of "remove db_num_rows()" patch: nothing special other than this.
  4. name of constraint can only be max. 18 characters, where column only support for max. 30 characters (yup, even worse than oracle: both max. 30). here i will need to split the trimming action into 2 parts: first handle constraint limitation, and than column. for all others (e.g. table or index name, can support for max. 128 characters), will be handled as like as column (max. 30) for standardize
  5. a huge size of reserved word list, when compare with ANSI. it comes with 168 (!?) extra reserved words, when compare with all version of ANSI standard. BTW, just feel free about this, we did similar rewrite action for oracle driver, and so it is just a simple clone

how come it can be complete within such short period (only 4 days)? the reason is very simple: we have already discover almost all special handle for overcoming database-specific limitation, when implementing oracle driver. we only need to clone, and rewrite those handle for DB2, and that's all :)

again, it is depending on 2 important patches due to cross DB compatibility concern: LOBs patch (http://drupal.org/node/147947) and "remove db_num_rows()" patch (http://drupal.org/node/163191). surly we also face some other small bugs among core modules, based on "query friendly" concern, but this is not a great problem. they can be handled one by one :)

Files: 

Comments

hswong3i’s picture

FileSize
49.66 KB

bug fix, code clean up, and function backport from Oracle and MSSQL driver. includes:

  1. add ANSI reserved word rewrite handling, as like as Oracle driver. this will handle the conflict between drupal's schema with ANSI standard
  2. update max. 18 and max. 30 handling. since table "variable" will create before any other tables (refer to http://drupal.org/node/165957), we no longer need to take special handling
  3. update db_query_range() and db_query_temporary(). code clean up and syntax update
  4. update db_encode_blob() and db_encode_clob(), with was buggy. as using "?" substitution in db2_execute(), no escape is required
  5. update some documents

patch required:
http://drupal.org/node/165957
http://drupal.org/node/147947

GNUMatrix’s picture

Hi there...

I gave this a try but couldn't make it through the installation script. It created tables in DB2 but the install fell apart shortly thereafter. As this was my very first attempt/experience with Drupal of any kind, I was trying pretty hard to get it to work, but didn't know much about why. I've since installed 5.2 with MySQL and got that to work without any issues at all.

Curiously, this post of yours doesn't show up when I search Drupal for DB2? But it does in google. To me, this is a huge deal as DB2-C (free) would make an impressive addition to Drupal's already quite capable features.

Do you have a set of procedures to follow to get this to work? I was trying it on an Ubuntu system, and had to jump through a lot of hoops to get the PDO stuff to work, and IBM_DB2 PHP support, etc. I did get all that done, but there should be a guide. I'd make one, but I obviously didn't do it right if it didn't work...

hswong3i’s picture

sorry that since i am now focusing on another 3 related patches: http://drupal.org/node/165957, http://drupal.org/node/147947 and http://drupal.org/node/168403, the update of the patch will be a bit late...

this patch is written for PHP IBM_DB2 (which should be the one that you mentioned). procedure shouldn't be too difficult:

  1. completely setup and test with IBM DB2 v9 + Linux + ZendCore for IBM
  2. create suitable database user account + database for drupal installation
  3. start your drupal installation, as like as what we work with MySQL/PgSQL

i will try my best to document the detail procedures as reference, as soon as i can (which similar as that for Oracle driver).

BTW, unless those patches listed above are all committed, both Oracle/DB2/MSSQL/etc will NEVER success. please find out the above patches, get, test and comment about it, in order to speed up multiple database supporting within D6 ;)

hswong3i’s picture

Version: 6.x-dev » 7.x-dev
Priority: Critical » Normal
Status: Needs review » Active

as mentioned in http://drupal.org/node/147947, this issue can seems as failed within D6 official development (yup, we fail for this once again... how pity...). BTW, this patch will not died: i will merge it together with Oracle driver (and also their related patches) into a single patch file, and keep on updating it within D6 life cycle. so people who are interested in this topic can get such supporting ON TIME, but not sit and waiting for D7 comes. i guess most of the projects needed for such unofficial patch are enterprise-related project, such little tailor-made handling may be acceptable for their professional and skillful developer :)

hswong3i’s picture

I am still working with this topic. As PDO and Oracle supporting by Siren is quite stable, the single and shared core code base should also suitable for DB2 development. On the other hand, as DB2 v9.5 is now released, the driver implementation should be much simpler. Please feel free to contact me if you are interesting in this topic ;-)

(This is part of my personal research project Siren's issue.)

derwiki’s picture

Hi hswong3i,

I'm a little new to trying things outside of MySQL for Drupal, but I am very interested in getting Drupal to work with DB2 Express-C. I'm a little confused though: where can I find the database.db2.inc file that you're working on? How is development going, are you still working on it at all?

thanks,
Adam

mav_ren’s picture

Hi hswong3i,

Im trying to install Drupal on a Z series IBM Server using DB2 and was wondering how you were going with the DB2 support? Is development still active?

Thanks,

Matthew Tapper

hswong3i’s picture

Currently I host the project in here: http://sourceforge.net/projects/siren/

Crell’s picture

Status: Active » Closed (won't fix)

Not in core. It can be done in contrib if anyone is interested.

thamizhg’s picture

Version: 7.x-dev » 6.14
Assigned: hswong3i » Unassigned
Category: feature » support
Status: Closed (won't fix) » Needs work

hai,

i am trying to use drupal with DB2. i created database.db2.inc and install.db2.inc file with the help of some patches.

Drupal get installed and it goes to initial site configuration page. after submitting that page, cache table update query is getting failed. It says too large size value to the data filed in cache table. But i am using data field with clob(2G).

pls anyone help me to resolve this.

Crell’s picture

Version: 6.14 » 7.x-dev
Category: support » feature
Status: Needs work » Closed (won't fix)

DB2 is not supported for Drupal 6 or Drupal 7 in core, and won't be supported in Drupal 8 core either. If you want to work on a DB2 driver, please start a contrib project and do not re-open dead core issues.

Note that the Drupal 7 DB layer is completely rewritten, so you're much better off starting with that as work done on a Drupal 6 driver would not really be helpful at all going forward.

mawool’s picture

Hello, i'm a newbie on drupal.
Now, i'm working with Drupal and DB2. but i still can't connect them.
there are 2 patches required that i can't have it because i don't understand how to use CVS.
May i have files on http://drupal.org/node/165957 and http://drupal.org/node/147947 like system.schema and the other on that issues.

thank before...

regards,