phporacle-databasesql-updateno-response

Oracle PHP update no response


I got a very weird problem with oracle today.

I setup a new server with xampp for developing, i activated mssql and oracle and everything was just fine until i tried to execute an update statement.

Every select, insert, etc is working fine with PHP 5.3.

I also can parse the statement and get a ressource id back, but when i try to execute the statement my whole site is not responding.

no error, nothing. just timeout until i restart the apache.

here the code... it's the test code, so there should be no problem at all.

$conn = oci_connect('***', '***', '***');

$query ="UPDATE CHAR*** SET TPOS = 14, ID = 5, DIFF = 'J' WHERE ***NR = '3092308' AND LA*** = '5'";
echo $query;
echo '<br>';
echo $stid = oci_parse($conn, $query);
oci_execute($stid, OCI_DEFAULT);    
oci_free_statement($stid2);

Any hints or ideas? :-( I already tried to reinstall the oracle instant client and another version. I am using 10g like our db at the moment.

best regards pad


Solution

  • The row may be locked by another session. If this is the case, your session will hang until the other transaction ends (commit/rollback).

    You should do a SELECT FOR UPDATE NOWAIT before attempting to update a row (pessimistic locking):

    There are other reasons why a simple update may take a long time but they are less likely, for instance:

    For further reading: pessimistic vs optimistic locking.