[PHP-DB] DB2 connection: Setting codepage
Hi all, I have some code that has to insert data into databases (DB2 AS400) coming from multilingual sources. The code on the Webserver is the same; that's why i can not use solution involving php configuration. For example: User 1 (English) logs into the application and submits some info (uploaded from an excel file); the program inserts it in the corresponding DB = OK. User 2 (Russian) logs in and submits his data = KO. I read the excel (Cp1251) fine but the insertion seems to be faulty (destination is CCSID 1025). I've seen db_client_info() function which tells the code page used; but how to set the code page before connecting (with db2_connect() ). Thans in advance, /Ahmed -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] DB2 - wrong number of parameters
Hi! I´m working with PHP 5 and using the DB2 database. I´m trying to update a jpg file, that´s save on the database. here´s the code: $fp = @fopen($caminho/$nome_arquivo, 'r'); $content = fread($fp, filesize($caminho/$nome_arquivo)); $content = bin2hex($content); fclose($fp); $conn = $this-DB2-getConn(); //get the connection id $q = update dbsm.FUNCIONARIOS set FOTO=? where ID_FUNCIONARIO=?; $res = odbc_prepare ($conn, $q); $array = array(); $array[0] = $content; //file $array[1] = $idFuncionario; $exc = odbc_execute($res, $array); but when I run it, the folow warning appears: Warning: odbc_execute() [function.odbc-execute]: SQL error: [IBM][CLI Driver] CLI0100E Wrong number of parameters. SQLSTATE=07001, SQL state 07001 in SQLExecute in C:\Arquivos de programas\Apache Group\Apache2\htdocs\principal\Portal\Repositorio\Funcionarios.class.php on line 170 what´s the problem??? thanks Pablo Garay Ijuí - UNIJUI RS - Brasil
Re: [PHP-DB] DB2 - wrong number of parameters
Pablo Garay wrote: Hi! I´m working with PHP 5 and using the DB2 database. I´m trying to update a jpg file, that´s save on the database. here´s the code: $fp = @fopen($caminho/$nome_arquivo, 'r'); $content = fread($fp, filesize($caminho/$nome_arquivo)); $content = bin2hex($content); fclose($fp); $conn = $this-DB2-getConn(); //get the connection id $q = update dbsm.FUNCIONARIOS set FOTO=? where ID_FUNCIONARIO=?; $res = odbc_prepare ($conn, $q); $array = array(); $array[0] = $content; //file $array[1] = $idFuncionario; $exc = odbc_execute($res, $array); but when I run it, the folow warning appears: Warning: odbc_execute() [function.odbc-execute]: SQL error: [IBM][CLI Driver] CLI0100E Wrong number of parameters. SQLSTATE=07001, SQL state 07001 in SQLExecute in C:\Arquivos de programas\Apache Group\Apache2\htdocs\principal\Portal\Repositorio\Funcionarios.class.php on line 170 what´s the problem??? Looks like a bug to me. I found this one: http://bugs.php.net/bug.php?id=37646 which is kinda related. Search bugs.php.net and see if it has been reported. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] DB2 +Windows +CLOB
Any example how to use CLOB,BLOB fields with PHP under Windows and DB2 ? Thanks in advance Javier Mestre -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DB2 +Windows +CLOB
The odbtp extension has be used quite successfully with DB2. You can get it at http://odbtp.sourceforge.net. I have not personnally used it with DB2, but there are posts on odbtp's help forum pertaining to DB2. -- bob On Tue, 3 Aug 2004, Javier Mestre wrote: Any example how to use CLOB,BLOB fields with PHP under Windows and DB2 ? Thanks in advance Javier Mestre -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DB2 +Windows +CLOB
On Tuesday 03 August 2004 09:02 am, Robert Twitty wrote: The odbtp extension has be used quite successfully with DB2. You can get it at http://odbtp.sourceforge.net. I have not personnally used it with DB2, but there are posts on odbtp's help forum pertaining to DB2. -- bob On Tue, 3 Aug 2004, Javier Mestre wrote: Any example how to use CLOB,BLOB fields with PHP under Windows and DB2 ? I use Robert's odbtp extension with DB2, with CLOB columns without any problems (haven't tried BLOB), on my dev box. There aren't any hoops to jump through, like when using php's native odbc extension. Granted I've only used it on a dev box, and not in production, means that I can say if it (odbtp) will handle all situations with BLOB/CLOB, so any experiences that you can provide would be great (that is if you run into any ;))... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] db2 as a module
Hi. We run PHP as a DSO through Apache with IBM DB2 support enabled. We want to be able to run the same PHP DSO module on a second machine that will not have support for DB2. How can I configure PHP via the configuration file such that DB2 support is enabled on one host, and not on another? Thanks for any help you can provide. Jason Keltz [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] DB2 and php serialized data
Most likely its not a PHP issue, but looking to see if anyone has run into this. I've inserted a serialized string, into a CLOB column. Trying to retrieve the column returns no results. If anyone has any DB2 experience, I'd be grateful if I can bounce a few questions to you offlist. Thanks for any advice/tips you may provide... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DB2 and php serialized data
Gerard Samuel wrote: Most likely its not a PHP issue, but looking to see if anyone has run into this. I've inserted a serialized string, into a CLOB column. Trying to retrieve the column returns no results. If anyone has any DB2 experience, I'd be grateful if I can bounce a few questions to you offlist. Thanks for any advice/tips you may provide... I did a few more tests last night, and the problem isn't with serialized data. Im currently testing to see if a result contains returned data by issuing odbc_num_rows() The wierd thing is that if I try to select a CLOB column (this is what Im using at the moment, but I believe it applies to all LOBs), odbc_num_rows() would return -1 If I do not select a CLOB (ie INTEGER, VARCHAR this is what Im currently testing with) column, odbc_num_rows() would return the correct number of rows. I've read about odbc_num_rows() returning -1 for some databases, but that statement alludes me to believe that it either works, or doesn't work for a database. Not whether it will work for some sql conditions. So Im not sure if this is a bug or not. Im currently testing with PHP 4.3.3R2, IBM DB2 8.1 Personal Edition on win2k/IIS 5 If what Ive noticed is the expected behaviour, please let me know so I'll know whether or not to fill out a bug report... If anyone wants more information, please let me know... Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] db2/db3 stability?
I encountered serious problems using (Berkeley) db2 db3 support! 1) dba_open fails (!) when the open flag is set to c and the file exists (c flag means: create if not exist, open r/w otherwise). This error is reproducible with a simple php script started from a CGI version of php4. The error message is something like failed to initialise database driver. 2) dba_insert and dba_replace both seem to fail at random and never work again! After the program runs for several minutes, and then suddenly refuses to do any more inserts (dba_insert/dba_replace do not break with a warning, but simply return false (and do not insert the data) ). I use keys that are of form prefix+(variable size number) like pr_12345 (prefix does not change), and the values are strings of HTML data with sizes from 1k to 10k. It is difficult to exactly reproduce this error due to its seemingly random appearance. Both errors are reproducible on Linux and FreeBSD machines. Are there any remedies? Would the old-style interface work? (performance?) -- - Ivan Voras ivoras @ fer.hr - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] DB2 Performance issue
Okay, one relevant issue is that PHP sets default cursor type to Dynamic. While this is a nice, potentially bidirectional and sensitive-to-change cursor it can be very expensive, some ODBC drivers don't support it (OpenLink's do) and Dynamic cursors typically dont work with tables lacking a primary key (e.g. views). To verify that this performance is directly the result of the default cursor setting, change SQL_CURSOR_DYNAMIC to SQL_CURSOR_STATIC in php_odbc.c and recompile. Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Mark Newnham [mailto:[EMAIL PROTECTED]] Sent: Monday, October 01, 2001 5:33 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] DB2 Performance issue This was posted on the newsgroup a couple of months ago: Christian Szardenings wrote: 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 This posting has caused some discussion amongst some of us who are trying to use DB2 in Native mode (i.e. using Unified ODBC) as the IBM driver manager appears not to support this parameter. ( An odbc connect with the specified parameter returns [IBM][CLI Driver] CLI0150E Driver not capable. SQLSTATE=S1C00 Could the author or anyone else who knows, please clarify this posting if they are using unified odbc or perhaps a third party ODBC driver. TIA Mark -- 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] DB2 Performance issue - More Info
From the IBM CLI Reference: SQL_ATTR_ODBC_CURSORS (DB2 CLI v5) This connection attribute is defined by ODBC, but is not supported by DB2 CLI. Any attempt to set or get this attribute will result in an SQLSTATE of HYC00 (Driver not capable). A 32-bit option specifying how the Driver Manager uses the ODBC cursor library. So I guess this means the message below was related to using a 3rd party odbc driver. Shucks.. Regards Mark -Original Message- From: Mark Newnham [mailto:[EMAIL PROTECTED]] Sent: Monday, October 01, 2001 3:33 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] DB2 Performance issue This was posted on the newsgroup a couple of months ago: Christian Szardenings wrote: 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 This posting has caused some discussion amongst some of us who are trying to use DB2 in Native mode (i.e. using Unified ODBC) as the IBM driver manager appears not to support this parameter. ( An odbc connect with the specified parameter returns [IBM][CLI Driver] CLI0150E Driver not capable. SQLSTATE=S1C00 Could the author or anyone else who knows, please clarify this posting if they are using unified odbc or perhaps a third party ODBC driver. TIA Mark -- 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] DB2 Performance issue - More Info
Hi Mark, Thanks for the investigation! Will add your comment to the db2 drivers of adodb. Regards, John Mark Newnham [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... From the IBM CLI Reference: SQL_ATTR_ODBC_CURSORS (DB2 CLI v5) This connection attribute is defined by ODBC, but is not supported by DB2 CLI. Any attempt to set or get this attribute will result in an SQLSTATE of HYC00 (Driver not capable). A 32-bit option specifying how the Driver Manager uses the ODBC cursor library. So I guess this means the message below was related to using a 3rd party odbc driver. Shucks.. Regards Mark -Original Message- From: Mark Newnham [mailto:[EMAIL PROTECTED]] Sent: Monday, October 01, 2001 3:33 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] DB2 Performance issue This was posted on the newsgroup a couple of months ago: Christian Szardenings wrote: 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 This posting has caused some discussion amongst some of us who are trying to use DB2 in Native mode (i.e. using Unified ODBC) as the IBM driver manager appears not to support this parameter. ( An odbc connect with the specified parameter returns [IBM][CLI Driver] CLI0150E Driver not capable. SQLSTATE=S1C00 Could the author or anyone else who knows, please clarify this posting if they are using unified odbc or perhaps a third party ODBC driver. TIA Mark -- 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]
[PHP-DB] DB2 Performance issue
This was posted on the newsgroup a couple of months ago: Christian Szardenings wrote: 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 This posting has caused some discussion amongst some of us who are trying to use DB2 in Native mode (i.e. using Unified ODBC) as the IBM driver manager appears not to support this parameter. ( An odbc connect with the specified parameter returns [IBM][CLI Driver] CLI0150E Driver not capable. SQLSTATE=S1C00 Could the author or anyone else who knows, please clarify this posting if they are using unified odbc or perhaps a third party ODBC driver. TIA Mark -- 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] db2 (or any unified ODBC db), php, stored procedures, and OUT parameters
I am trying to return an OUT or INOUT parameter from a stored procedure call to PHP via the Unified ODBC functions. I've RTFM and I don't see anything on this. I've tried to pass a variable to an INOUT parameter via the parameters array in odbc_execute. Is there any trick or hack to work around this. I'm trying to return a string from a DB2 (SQL-Procedural Language) stored procedure to PHP. I'd appreciate any help. I wouldn't mind hearing back from anyone whose tried the same thing with other databases using the Unified ODBC library. Thanks for any help in advance, Alex Mikhail
Re: [PHP-DB] db2
Will my db2 connection (using odbc_connect and the CLI driver) close when the script ends, or should I always call odbc_close? It should. otherwise if something goes wrong in the script, then connection still open. One of the disadvantages of pconnect. Ended up DOS'ing the AS400 ;-) marios _ Valentines Day Special Offer: 1 Dozen Long Stemmed Red Roses including a FREE box of Cadbury's Milk Tray for only R199. Place your order before the 5th of February and get FREE delivery. http://www.netactive.co.za/linktrack/track.asp?rc=nflpe Message Sent Using NetActive Personal _ -- 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] db2 with php
I've installed db2 and created the default instance at /home/db2inst1/. PHP is compiled with the --with-ibm-db2 option, however when I try to start apache I get the message: "Cannot load /etc/httpd/modules/libphp4.so into server: libdb2.so.1: cannot open shared object file: No such file or directory" when I try to load the php4 module. libdb2.so.1 exists in /home/db2inst1/sqllib/lib/ so I'm not sure why php can't find it. Can anyone help me with this? Default installation of DB2 under redhat failed to properly setup automatically the environment at reboot (at least for me), so that I had to manually set it. There is a script file that does this under the instance dir. Try "source /home/db2inst1/sqllib/db2profile" If after that all works, you can put that in rc.local or wherever you feel it could be its place :-) HTH, bye Fabrizio /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ Fabrizio Ermini Alternate E-mail: C.so Umberto, 7 [EMAIL PROTECTED] loc. Meleto Valdarno Mail on GSM: (keep it short!) 52020 Cavriglia (AR) [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] db2 with php
Well, if it says that it's looking for it in /etc/httpd/modules then it's obviously not looking in /home/db2inst1/sqllib/lib, eh? Try a symlink... "ln -s /home/db2inst1/sqllib/lib/libdb2.so.1 /etc/httpd/modules/libphp4.so/libdb2.so.1" Or copy the library. Or I think you can add a line into /etc/ld.so.conf too. -Szii At 11:08 PM 2/4/2001 -0500, Chris Book wrote: Hello, I've installed db2 and created the default instance at /home/db2inst1/. PHP is compiled with the --with-ibm-db2 option, however when I try to start apache I get the message: "Cannot load /etc/httpd/modules/libphp4.so into server: libdb2.so.1: cannot open shared object file: No such file or directory" when I try to load the php4 module. libdb2.so.1 exists in /home/db2inst1/sqllib/lib/ so I'm not sure why php can't find it. Can anyone help me with this? Thanks, Chris Book [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] -- 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]