Lynn Thames
asked on
Could the php mssql_query function be locking tables in the SQL database?
Hi, I am using the following code to query a remote SQL server with a select statement. Could this be locking that database?
Thanks for any direction you can give!
Thanks for any direction you can give!
$link = @mssql_connect($myServer,$myUser,$myPass);
mssql_select_db($myDB) or die('Couldn\'t load database');
$qry = "Select cast(GUIDProduct as varchar(36)) as myProductGUID, DATALENGTH(ProductPicture) as myImageSize, *
from Product";
$rs = mssql_query($qry);
$RowCount = mssql_num_rows($rs);
if($RowCount>0){
while($rows = mssql_fetch_assoc($rs)){
//do something with recordset
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
& Thanks for the quick grading :)
You will need to discuss this with the client then. If "syncing" I'd assume you only want valid data on the website, so using "with nolock" might be risky given that:
> an import might fail
> you are also being slowed down by connection speed.
They may be willing to use READ_COMMITTED_SNAPSHOT on perhaps?
Good luck with this project.
Paul
You will need to discuss this with the client then. If "syncing" I'd assume you only want valid data on the website, so using "with nolock" might be risky given that:
> an import might fail
> you are also being slowed down by connection speed.
They may be willing to use READ_COMMITTED_SNAPSHOT on perhaps?
Good luck with this project.
Paul
ASKER
This definitely explains what's going on. They are trying to import products into the database (which in that app requires exclusive lock during the import) and at the same time my php script is syncing the products to their webstore . . . . . and their internet connection is so slow that a query that normally takes 1-2 seconds is taking 3 minutes!!!!!!!!!!