473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Transaction effect PHP+DB2 v 8.1.12 Linux

If I'm in a transaction started with 'odbc_autocommit($dbConn, FALSE);'
and I UPDATE a row in tablex, then later SELECT FROM tablex, will I see
the updated row or the original row? If it will help with suggestions, I
would prefer to see the updated row.
Oct 2 '06 #1
6 1827
Bob Stearns wrote:
If I'm in a transaction started with 'odbc_autocommit($dbConn, FALSE);'
Just a friendly advice: use the DB2 PHP driver and not the ODBC one. The
old ODBC driver has quite a lot of problems.
and I UPDATE a row in tablex, then later SELECT FROM tablex, will I see
the updated row or the original row? If it will help with suggestions, I
would prefer to see the updated row.
Depends:
(1) If the SELECT is in the same transaction as the UPDATE, you will see the
changed row.
(2) If there was a COMMIT after the UPDATE, the SELECT will see the changed
row as well.
(3) If there was no end-of-transaction after the UPDATE, and if you don't
use UNCOMMITTED READ isolation level for the transaction running the
SELECT, then the SELECT won't see the changes.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Oct 2 '06 #2
Knut Stolze wrote:
Bob Stearns wrote:

>>If I'm in a transaction started with 'odbc_autocommit($dbConn, FALSE);'


Just a friendly advice: use the DB2 PHP driver and not the ODBC one. The
old ODBC driver has quite a lot of problems.

>>and I UPDATE a row in tablex, then later SELECT FROM tablex, will I see
the updated row or the original row? If it will help with suggestions, I
would prefer to see the updated row.


Depends:
(1) If the SELECT is in the same transaction as the UPDATE, you will see the
changed row.
(2) If there was a COMMIT after the UPDATE, the SELECT will see the changed
row as well.
(3) If there was no end-of-transaction after the UPDATE, and if you don't
use UNCOMMITTED READ isolation level for the transaction running the
SELECT, then the SELECT won't see the changes.
Thank you. I am in case 1, so all is well. For my future information is
the isolation level (case 3) settable in the odbc or db2 environments? How?

Is there a simple 1-1 mapping between the odbc calls and the db2 calls
(the db2 stuff is documented where, please) so that I could use sed on
my source tree to change over? Is the use of odbc in some modules
compatible with using db2 in others or will someone get upset? BTW, I've
had no real show stopper problems with the PHP 4.4 odbc drivers, but PHP
was compiled / installed with the db2 stuff enabled, which, as I
understand it, affects how the odbc calls work.
Oct 2 '06 #3
Bob,

If there is no connection attribute for teh isolation level you can
always execute a SET SQL statement after connecting to set the misc
registers.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Oct 2 '06 #4
Serge Rielau wrote:
Bob,

If there is no connection attribute for teh isolation level you can
always execute a SET SQL statement after connecting to set the misc
registers.

Cheers
Serge
Thanks for the info. Either you are up very early, or on the other side
of the pond. I am up very late, but going to bed.
Oct 2 '06 #5
Bob Stearns wrote:
Knut Stolze wrote:
>Bob Stearns wrote:

>>>If I'm in a transaction started with 'odbc_autocommit($dbConn, FALSE);'


Just a friendly advice: use the DB2 PHP driver and not the ODBC one. The
old ODBC driver has quite a lot of problems.

>>>and I UPDATE a row in tablex, then later SELECT FROM tablex, will I see
the updated row or the original row? If it will help with suggestions, I
would prefer to see the updated row.


Depends:
(1) If the SELECT is in the same transaction as the UPDATE, you will see
the changed row.
(2) If there was a COMMIT after the UPDATE, the SELECT will see the
changed row as well.
(3) If there was no end-of-transaction after the UPDATE, and if you don't
use UNCOMMITTED READ isolation level for the transaction running the
SELECT, then the SELECT won't see the changes.
Thank you. I am in case 1, so all is well. For my future information is
the isolation level (case 3) settable in the odbc or db2 environments?
How?
I believe that DB2-PHP has a function with which you can set the isolation
level. Additionally, PHP uses CLI to communicate with DB2.
The "db2cli.ini" (which is the same as the CLI CFG) allows you to specify
the default isolation level.
Is there a simple 1-1 mapping between the odbc calls and the db2 calls
(the db2 stuff is documented where, please) so that I could use sed on
my source tree to change over?
Yes, there is. Basically, change the "odbc_" prefix to "db2_". Docs can be
found here: http://de.php.net/ibm_db2
Is the use of odbc in some modules
compatible with using db2 in others or will someone get upset?
As long as you don't try to mix and match objects, you shouldn't have a
problem.
BTW, I've
had no real show stopper problems with the PHP 4.4 odbc drivers, but PHP
was compiled / installed with the db2 stuff enabled, which, as I
understand it, affects how the odbc calls work.
I wasn't saying that it does not work at all. But I know that BLOBs/CLOBs
don't work in the regular ODBC driver. You may get results that look good,
but effectively there is no support for these data types. So you can
easily run into trouble (I did) and you will have to dig through the
PHP/ODBC code to figure out what went wrong. Additionally, the DB2-PHP
driver is better performing, fixes a bunch of other problems (that I
haven't hit myself yet with ODBC), and it is actively maintained by IBM.
The same cannot be said about the ODBC stuff. If you can, I'd recommend
that you switch to the newer implementation.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Oct 2 '06 #6
Bob Stearns wrote:
Thanks for the info. Either you are up very early, or on the other side
of the pond. I am up very late, but going to bed.
IDUG Vienna

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Oct 2 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Google Mike | last post by:
Anyone having any luck to get PHP on Linux to talk to MS SQL Server 2000 via FreeTDS? Where do I begin? I'm a Linux newbie and a PHP newbie, but I'd say I'm beyond the idiot stage. I mean, I've...
0
by: Google Mike | last post by:
After a lot of thought and research, and playing with FreeTDS and InlineTDS, as well as various ODBC connections, I have determined that the fastest and cheapest way to get up and going with PHP on...
0
by: Jim Gerland | last post by:
When I access my DB2 table from a W2K machine running PHP using ODBC with the SQL statement: SELECT DOUBLE(BGROUP.PYHGPT.GPPRAM) I get: 2376.92 but when I do the same from my iSeries...
3
by: kamlai | last post by:
I'm using PHP + apache2 in Linux platform. I found that the upload_max_filesize has only 2M. I want to increase this limit but I don't know where can I set it. I'm using Linux so I don't have...
5
by: crunix | last post by:
Hello. I have developed a medical application with php 4 linked to IBM DB2 database. The database connection is right and i can access data with no problem...but sometimes when i reload the...
5
by: Bill | last post by:
Hi, I discovered adodb and is use it now in order to connect from PHP to ms Access under Windows. No problem. Is this also applicable to PHP under linux, because i get a lot of errors like:...
3
by: Bob Stearns | last post by:
I am doing an insert into a table with a generated key. How do I obtain the generated key of the record I just inserted?
2
by: philbo30 | last post by:
I have data processing that takes place via an application written in C. I also have a .php webpage that displays a chart of the results via the Netscape 4.79 browser. Currently, manual...
0
by: J.O. Aho | last post by:
admin@ng2000.com wrote: If you have promote a news, use a proper link and not a crappy headlines list http://www.linuxtoday.com/developer/2008112100735OSDV -- //Aho
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.