Skip to Content.
Sympa Menu

freetds - Re: [freetds] mssql_execute(): stored procedure execution failed

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Sylvain Viart - Gmail <sylvain.viart AT gmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] mssql_execute(): stored procedure execution failed
  • Date: Tue, 08 Jun 2010 17:07:45 +0200

Hi Robert,

Following you idea (mssql_free_result) I've found :


On 02/06/2010 19:10, Robert Gonzalez wrote:
If you are good with the notion of rewriting your code, you could always hit
the database directly with mssql_query(). You can use mssql_next_result()
for multiple result sets with it too. I do that all the time in all of my
SQL Server code. But that would probably require you to rewrite all of your
queries. Not sure if that is something you are interested in doing.
yes somewhat very much rewriting. we have more than 700 stored procedure calls !

quote from http://www.freetds.org/faq.html
Why does each connection support only one query at a time?

The client library is tightly coupled to the server; they are synchronized, share state information. The server requires the client either to read all the results from a query, or to indicate that no further rows are desired i.e., to issue a cancellation. Until one of those two things happens, the server will not accept new queries on that connection. It will complain about "pending results".

sick, that why this ugly old code generate so much error.
We corrected some main errors in the code and it's really better.

I also changed mssql_pconnect() to mssql_connet()

Which has also dropped the error count in the php error log.
The error in now more on the connection :

[08-Jun-2010 16:32:10] PHP Warning: mssql_connect(): Unable to connect to server: syndb02 in conn_d2.php on line 71

yesterday
grep -c mssql_connect /var/log/php/d2/php.log.1
19288

today (half)
grep -c mssql_connect /var/log/php/d2/php.log
9853

Can I catch the error reason somewhere?
mssql_get_last_message() gives nothing !

this code
my_log("$try mssql_connect error:". mssql_get_last_message() .":");
gives:
2010/06/08 16:47:02 1 mssql_connect error:: /got_mail.php

:-)
of course the connection has failed, so there's no connection to use with mssql_get_last_message()

So I use :
$errs = error_get_last();
my_log("$try echec mssql_connect error:". $errs['message'] ." :");

2010/06/08 17:00:52 1 mssql_connect error:mssql_connect(): Unable to connect to server: syndb02 : /got_mail.php


Another, better, option is to do what you are doing with wrapping the calls.
The one thing you need to do though is free up your result instead of just
returning it. But that carries with it the additional overhead of converting
all of your result resources into arrays before returning them, which can
get memory intensive for a large volume of queries or for very large data
sets. Seems to me to be a bit of catch 22 in this case.
"catch 22" ? :-)

wikipedia quote : the self-contradictory circular logic

héhé, right...
I gonna fix only major errors and wait that the error count decrease...


Thanks for your suggestion.
Sylvain.





Archive powered by MHonArc 2.6.24.

Top of Page