Re: [PHP-DB] IBM DB2
Robert Twitty wrote: On Thu, 19 Aug 2004, Gerard Samuel wrote: Robert Twitty wrote: Hi 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 http://publib.boulder.ibm.com/infocenter/db2help/topic/com.ibm.db2.udb.doc/ad/r0007623.htm 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 http://www14.software.ibm.com/webapp/download/search.jsp?rs=db2pde 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. Dan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] IBM DB2
Robert Twitty wrote: On Thu, 19 Aug 2004, Gerard Samuel wrote: Robert Twitty wrote: Hi 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. Unfortunately, I trashed my dev box by fdisking it last week. Hopefully in the next week or two, when I get some time, I'll be rebuilding it, and I'll take a look at stored procedures to see if its doable or not. I know where to find you... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] IBM DB2
Hi 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. -- bob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] IBM DB2
Robert Twitty wrote: Hi 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... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] IBM DB2 and php
Maybe in early August, I got my code to work with DB2 8.1.3 via ODBC after a bit of teeth pulling. I played with it for about 2-3 weeks, and it seemed ok (slow but ok). Earlier this past week, I was modifying the DB drivers for my script, and now, DB2 refuses to cooperate. I don't remember changing any php.ini settings so Im confused as to why it doesn't work now. Im testing on w2k, php 4.3.3, db2 8.1.3 The problem revolves around field lengths being too long, because, as soon as I select a text field, the query fails, when trying to retrieve specific result rows. If anyone can shed any light on this, I would greatly appreciate it. Thanks php.ini settings ; Handling of LONG fields. Returns number of bytes to variables. 0 means ; passthru. odbc.defaultlrl = 4096 ; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. ; See the documentation on odbc_binmode and odbc_longreadlen for an explanation ; of uodbc.defaultlrl and uodbc.defaultbinmode odbc.defaultbinmode = 1 example script |?php ||// contains db connection stuff| |include('include.php'); // body is a text field $sql = 'select id, user_id, name, time, body, ip from NULLID.guestbook for read only'; $result = odbc_exec($db-_connection_id, $sql); odbc_longreadlen($result, 0); odbc_binmode($result, 0); // Trying to retrieve 2nd row out of 6 rows returns false when // the query contains a text field var_dump(odbc_fetch_array($result, 2)); ?| -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] IBM DB2 and php
Gerard Samuel wrote: example script |?php ||// contains db connection stuff| |include('include.php'); // body is a text field $sql = 'select id, user_id, name, time, body, ip from NULLID.guestbook for read only'; $result = odbc_exec($db-_connection_id, $sql); odbc_longreadlen($result, 0); odbc_binmode($result, 0); // Trying to retrieve 2nd row out of 6 rows returns false when // the query contains a text field var_dump(odbc_fetch_array($result, 2)); ?| Sorry, bad copy/paste ?php // contains db connection stuff |include('mainfile.php'); |// body is a text field |$sql = 'select id, user_id, name, time, body, ip from NULLID.mpn_guestbook for read only'; $result = odbc_exec($mpn2_db-_db_connection_id, $sql); odbc_longreadlen($result, 0); odbc_binmode($result, 0); |// Trying to retrieve 2nd row out of 6 rows returns false when // the query contains a text field |var_dump(odbc_fetch_array($result, 2)); ? | -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] IBM DB2 PHP 4.3.2 behaviour
For the most part, I got my code running with IBM DB2 8.1.3 But its slower than dirt. Maybe 1 out of 10 times, a page would exceed the 30 second time limit. I understand on a fresh database startup, it takes time to get things together to run. But sometimes it would seem like its going fast, then othertimes, crawl slower than snails. Im just checking with the crowd that uses DB2 via PHP to see if they get similar behaviour with DB2. Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] IBM DB2 PHP 4.3.2 behaviour
Gerard Samuel mailto:[EMAIL PROTECTED] wrote on Tuesday, August 19, 2003 2:32 PM: I understand on a fresh database startup, it takes time to get things together to run. But sometimes it would seem like its going fast, then othertimes, crawl slower than snails. I've found that, with an AS/400, I had to build the proper indexes, such as an upper case only version for performing LIKE '%LASTNAME%' searches, *and* tell DB2 which index to use on the SELECT statement such as: SELECT MMLNAM from ADDRBOOKL2 where MMLNAM LIKE 'SAMUEL%' If I didn't point the select to the index, for some reason it wouldn't choose it. The folks at IBM Rochester Support Line told me to do this, but it seems to me that DB2 should be doing that leg work for me. It did decrease response time from 4 minutes to 5 seconds -- which is still slow. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] IBM DB2 PHP 4.3.2 behaviour
Matt Schroebel wrote: Gerard Samuel mailto:[EMAIL PROTECTED] wrote on Tuesday, August 19, 2003 2:32 PM: understand on a fresh database startup, it takes time to get things together to run. But sometimes it would seem like its going fast, then othertimes, crawl slower than snails. I've found that, with an AS/400, I had to build the proper indexes, such as an upper case only version for performing LIKE '%LASTNAME%' searches, *and* tell DB2 which index to use on the SELECT statement such as: SELECT MMLNAM from ADDRBOOKL2 where MMLNAM LIKE 'SAMUEL%' If I didn't point the select to the index, for some reason it wouldn't choose it. The folks at IBM Rochester Support Line told me to do this, but it seems to me that DB2 should be doing that leg work for me. It did decrease response time from 4 minutes to 5 seconds -- which is still slow. My biggest problem with it now, is that it seems it runs out of breath, every so often. It would be fairly quick, then slow down, then pick up the pace, then slow down. All this is run on a 1800XP/256M Ram Development box, where Im the only one accessing the database. I would even go as far to say that MSSQL is faster than DB2, from what Ive seen so far... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] IBM DB2 on Linux with PHP is very slow
I'm experiencing slowness in the fetching of result sets. I set the cursortype parameter as suggested by Christian Szardenings to SQL_CUR_USE_ODBC, and I get the following: Warning: SQL error: [IBM][CLI Driver] CLI0150E Driver not capable. SQLSTATE=S1C00, SQL state S1C00 in SQLSetConnectOption in /home/butcher/public_html/php/service_portal/content.php(68) : eval()'d code online 56 msg: [IBM][CLI Driver] CLI0150E Driver not capable. SQLSTATE=S1C00 The SQLSTATE pretty well says it all - I've been through the CLI docs and all the words indicate that this cursortype isn't supported. Side note: according to the IBM docs, SQLSetConnectOption is deprecated in favor of SQLSetSQLAttr or some such... Anyone have any clues? I'm using DB2 V7.1. Regards, Glenn Butcher PS - I sent a similar query last week; my identity wasn't properly configured and my reply-to address went out as an IP address - my apologies. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] IBM DB2 on Linux with PHP is very slow
Christian, Are you using an ODBC driver or just the unified-ODBC functions? If a driver, then I suggest changing vendors - that performance is in no way representative of ODBC in general. In addition, to improve performance even more when using similar queries, first use odbc_prepare to prepare a parameter-bound query and then use odbc_execute to create the result set for specific parameter values. You may wish to try our Multi-Tier drivers at http://www.openlinksw.com. Multi-Tier UDA is exceptionally fast and secure, and downloads with a free, non-expiring 2 user license. In addition, free support is available at http://www.openlinksw.com/support/suppindx.htm Please let me know if you require assistance. Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: news.php.net [mailto:[EMAIL PROTECTED]] Sent: Monday, July 09, 2001 5:59 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] IBM DB2 on Linux with PHP is very slow Hi, does someone has a DB2 UDB from IBM working with PHP in a production envirement ? How is the performance? For a relaunch of our existing production system running on IBM DB2 on serveral IBM RS/6000 servers we tested the performance of connecting PHP to this database. And what can I say: It's very slow. For example: A simple SELECT Query giving 100 records as result takes about 6 until 10 seconds(!!!) when using PHP. In detail: Connecting to Database lasts about 0.01 - 0.05 seconds (so, 10 ms - 50 ms), sending the query (odbc_exec... ) lasts about the same time. Then the bottleck: reading each record with odbc_fetch_into lasts between 0.02 till sometimes 2 (two seconds!!!). Now maybe you guess it's a problem of the DB2? We tested the same query on the same server with a simple java-servlet with jdbc, and the whole thing (connecting, query, and getting all records) lasts about 0.09 till 0.2 seonds So PHP is almost 300% till 500% slower!! I searched all newsgroups and I found some people that has/had the same problems. We couldn't solve that problem by removing the TCP/IP Problem of DB2 (setting some value ...mgnr = 1, i don't remember it's name :-))). No our CEO says, we should code the application in JAVA, but that seems a very poor solution for us. So my question: Does anybody had similar problems and solved it? Or is anybody willing to help us? Maybe we can find some other companies/people that also want to connect to DB2 with a good performance, and we could improve the DB2 functions of PHP or writing our own?? Or whats with other databases: are there similar problems with Oracle??? Oralce would be a great idea, but we spent some huge amount on the db2 so maybe it's no good idea to put the db2 into the trashcan and buy oracle for thousands of dollars. What's with Postgres? Our problem is that we must store 10 million records a month, and the database shouldn't have a problem with this. Thank you for reading this, and maybe someone can help, Kind regards, Christian Szardenings -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] IBM DB2 on Linux with PHP is very slow
Hi Andrew, thanks a lot for your help. Today we discovered what our real problem was: After playing a little bit with the php-scripts that try to connect to the IBM DB2, we set the optional parameter Cursortype when calling odbc_pconnect(). And the exciting thing: When we set the cursor type to SQL_CUR_USE_ODBC Cursor Type, then the whole query speed up from 1 till 10 seconds to 0.2 till 0.3 seconds for 100 records. Amazing!!! Therfore, PHP is just almost fast as calling the DB2 from Servlets using JDBC (don't take too much care about the speed at whole: the database was on a completely other location, so the whole connection was made over a slow network connection). I hope this helps when other encounter the same problem when trying to connect to DB2 from PHP. Kind regards, Christian Szardenings Andrew Hill [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Christian, Are you using an ODBC driver or just the unified-ODBC functions? If a driver, then I suggest changing vendors - that performance is in no way representative of ODBC in general. In addition, to improve performance even more when using similar queries, first use odbc_prepare to prepare a parameter-bound query and then use odbc_execute to create the result set for specific parameter values. You may wish to try our Multi-Tier drivers at http://www.openlinksw.com. Multi-Tier UDA is exceptionally fast and secure, and downloads with a free, non-expiring 2 user license. In addition, free support is available at http://www.openlinksw.com/support/suppindx.htm Please let me know if you require assistance. Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] IBM DB2 on Linux with PHP is very slow
Hi, does someone has a DB2 UDB from IBM working with PHP in a production envirement ? How is the performance? For a relaunch of our existing production system running on IBM DB2 on serveral IBM RS/6000 servers we tested the performance of connecting PHP to this database. And what can I say: It's very slow. For example: A simple SELECT Query giving 100 records as result takes about 6 until 10 seconds(!!!) when using PHP. In detail: Connecting to Database lasts about 0.01 - 0.05 seconds (so, 10 ms - 50 ms), sending the query (odbc_exec... ) lasts about the same time. Then the bottleck: reading each record with odbc_fetch_into lasts between 0.02 till sometimes 2 (two seconds!!!). Now maybe you guess it's a problem of the DB2? We tested the same query on the same server with a simple java-servlet with jdbc, and the whole thing (connecting, query, and getting all records) lasts about 0.09 till 0.2 seonds So PHP is almost 300% till 500% slower!! I searched all newsgroups and I found some people that has/had the same problems. We couldn't solve that problem by removing the TCP/IP Problem of DB2 (setting some value ...mgnr = 1, i don't remember it's name :-))). No our CEO says, we should code the application in JAVA, but that seems a very poor solution for us. So my question: Does anybody had similar problems and solved it? Or is anybody willing to help us? Maybe we can find some other companies/people that also want to connect to DB2 with a good performance, and we could improve the DB2 functions of PHP or writing our own?? Or whats with other databases: are there similar problems with Oracle??? Oralce would be a great idea, but we spent some huge amount on the db2 so maybe it's no good idea to put the db2 into the trashcan and buy oracle for thousands of dollars. What's with Postgres? Our problem is that we must store 10 million records a month, and the database shouldn't have a problem with this. Thank you for reading this, and maybe someone can help, Kind regards, Christian Szardenings -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] ibm db2
Hi All, I've noticed that IBM is making its DB2 database available for Linux platforms. Does anyone know if there will be PHP support for it? Thank you, Mike Wright -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] ibm db2
ODBC access to DB/2 works just fine via PHP. For a HOWTO on enabling ODBC in PHP, see www.iodbc.org. Best regards, Andrew -- Andrew Hill - OpenLink Software Director Technology Evangelism Universal Data Access Integration http://www.openlinksw.com -Original Message- From: Mike Wright [mailto:[EMAIL PROTECTED]] Sent: Friday, April 27, 2001 1:05 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] ibm db2 Hi All, I've noticed that IBM is making its DB2 database available for Linux platforms. Does anyone know if there will be PHP support for it? Thank you, Mike Wright -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] IBM DB2 connectction problems
I think it's more likely that you haven't sourced the /home/db2inst1/sqllib/db2profile script in whatever wrapper script starts up Apache for you. Add the following line to the top of 'apachectl' or '/etc/rc.d/init.d/httpd' to set up the DB2 environment variable before you start your webserver: . /home/db2inst1/sqllib/db2profile Dan ManieQ wrote: OK, here are some important details about my system: 1. Linux (Mandrake 7.2) 2. Apache 1.3.14 (from distribution) 3. jre118 (rpm, IBM version) 4. IBM DB2 V7.1 Installed with default logins, directories, etc. 5. Added '/usr/IBMdb2/V7.1/lib' to '/etc/ld.so.conf'; 'ldconfig' executed 6. PHP 4.0.3pl1 From source rpm, but compiled manually (not rpm build). I used '--with-ibm-db2' option and also some others like '--with-apxs --with-ldap' etc. 7. Modified apache conf to use PHP. I'm sure libdb2.so is used, because when I remove (5) line from 'ld.so.conf' I cannot start apache (missed library). Also tried '/home/db2inst1/sqllib/lib' - no result. Tried to start apache as db2inst1 user (http.conf - User) - still nothing. So, I still think about DB2 version incompatibilities. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] IBM DB2 connectction problems
If you're running off a unix platform, did you bind your database to CLI? I'm assuming you're trying to connect with CLI and not ODBC (ie you compiled with --with-ibm-db2) Chris -Original Message- From: ManieQ [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 13, 2001 7:07 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] IBM DB2 connectction problems hello, $i = odbc_connect( "sample", "db2inst1", "ibmdb2" ); I changed, but got same (= none) result. Please provide more detailed information on the SQL error and SQL state. Otherwise it is not really easy to tell, what the problem is. Well, as I posted, my SQL error is null and state is random/accidental string. I wonder if it is a version problem (I use db2 v7.1 - perhaps some api changes were made in this release?). ManieQ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] IBM DB2 connectction problems
OK, here are some important details about my system: 1. Linux (Mandrake 7.2) 2. Apache 1.3.14 (from distribution) 3. jre118 (rpm, IBM version) 4. IBM DB2 V7.1 Installed with default logins, directories, etc. 5. Added '/usr/IBMdb2/V7.1/lib' to '/etc/ld.so.conf'; 'ldconfig' executed 6. PHP 4.0.3pl1 From source rpm, but compiled manually (not rpm build). I used '--with-ibm-db2' option and also some others like '--with-apxs --with-ldap' etc. 7. Modified apache conf to use PHP. I'm sure libdb2.so is used, because when I remove (5) line from 'ld.so.conf' I cannot start apache (missed library). Also tried '/home/db2inst1/sqllib/lib' - no result. Tried to start apache as db2inst1 user (http.conf - User) - still nothing. So, I still think about DB2 version incompatibilities. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] IBM DB2 connectction problems
Hi, It should read: $i = odbc_connect( "sample", "db2inst1", "ibmdb2" ); Please provide more detailed information on the SQL error and SQL state. Otherwise it is not really easy to tell, what the problem is. ManieQ wrote: $i = odbc_connect ("PROTOCOL=TCPIP; SERVERNAME=jajo.tpi.pl; SERVICE=50002; DATABASE=SAMPLE", "db2inst1", "ibmdb2" ); I receive: Warning: SQL error: , SQL state czen?L@Polaczen in SQLConnect in /home/manieq/web/db21.php on line 5 -- --- Helmut NoCarrier Tessarek --- [EMAIL PROTECTED] --- IBM Certified Solution Expert Microsoft Certified Systems Engineer (MCP, MCP+I, MCSE) Karmarschgasse 53/1/3/11, A-1100 Vienna, Austria - http://www.evermeet.cx - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]