Re: PECL Account Request: mcyra

From: Date: Tue, 27 Jul 2004 15:59:06 +0000
Subject: Re: PECL Account Request: mcyra
References: 1 2  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-1047@lists.php.net to get a copy of this message
> Can you tell us a bit more about it? > Posting a link to your extension would be great too. Sorry, no link at now, i am working on a website for it. At work, we need a solution for transfering 2.000.000 rows a 4.000 byte into a DB2 table. Using ODBC and insert statements with PHP it will take near 18 hours to import the complete table. (There are many indexes on this table and the table have 120 columns) This was the time, i was searching for an alternative solution to import the data into the table. I found the LOAD utility, wich is distributed together with the clientsoftware from IBM. Using the LOAD utility from IBM it will take 45 minutes to load the data into the table. But the LOAD utility from IBM is a commandline tool. You could only use it with a system(); call from PHP. But youll get no results and must parse a messagefile for information about the load task. Not my preferred solution. Then i tried to use LOAD over ODBC with PHP, but this fails, because the generic ODBC driver from PHP did not support utility functions from IBM. Searching the web i found many hints, using the CLI API from IBM, but no single implementation in PHP or JAVA or Perl. So i decide, to get into extension programming and write my own wrapper to the client API from IBM. At the moment, the php_db2util extension supports: *) connecting to DB2 *) load data from client or server with replace option or insert option *) export data from table to client ( also not possible with ODBC ) *) run the runstats utility to recreate indexes ( also not possible with ODBC ) *) disconnect from DB2 All this functions returns the count of the written/exported/readed lines to the calling function. Exsample: <?php /* connecting to DB2 */ $conn = db2util_connect ( database, user, password ); /* load the data */ $aResult = db2util_load ( $conn, table, fileAndPathToLoadFrom, client|server, REPLACE|INSERT, [logfile] ); /* checking results will output array: rows read, rows inserted, rows deleted, rows rejected, rows skipped */ print_r( $aResult ); /* make indexes actual */ $aResult = db2util_runstats ( $conn, table ); /* disconnect from DB2 */ $aResult = db2util_disconnect ( $conn ); ?> Export works the same way. This extension will not replace the ODBC support to IBM DB2, it will extend it. Tested system: Windows 2000, IBM DB2 UDB 7.2 and IBM DB2 UDB 8.2, PHP 4.3.8 compiled with VC++. Requirements: You must have installed the runtime client from IBM for accessing the API libs. You can get the runtime client free as fixpack from the IBM website. There is also a free developer version of DB2 8.2. I think, this is a great extension for PHP, particulary because there is no implementation in Java nor in Perl. So will PHP be the only scripting language with support of the mass-data-movement-functions of IBM's DB2. Sorry for my bad English, but school is long ago for me. ;-) mcyra aka Michael Brauchl --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.701 / Virus Database: 458 - Release Date: 07.06.2004

« previous php.pecl.dev (#1047) next »