You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Torge Riedel <to...@gmx.de> on 2014/06/29 14:25:44 UTC

[users@httpd] mod_authn_dbd: Stored procedures not supported ... "Commands out of sync; you can't run this command now"

Hi,

I'm having a server installed with Apache 2.2 (Ubuntu LTS 12.04) and I used mod_authn_dbd as documented here

http://httpd.apache.org/docs/2.2/mod/mod_authn_dbd.html

to check the permissions.

Since I use a MySQL database

DBDriver mysql

is set.
Since there is already an existing user management on a different server with access restrictions, the only way to use it is via a stored procedure, thus

AuthDBUserPWQuery "CALL queryUser(%s)"

is defined like this.
But this is a problem, since MySQL is - let's say - a little bit special when performing a query which is a call to a stored procedure. If
you just perform the query and fetch the result, the next query within the same connection will fail with "Commands out of sync; you can't run this command now" error.

The reason is that when performing a query with a call to a stored procedure you must take result sets into account like you do when doing a multi-query.

Multi-Query:

"SELECT * FROM tUsers1; SELECT * FROM tUsers2;"

returns in MySQL two result sets and you have to use

mysql_use_result()
mysql_store_result()
mysql_free_result()

to properly handle the returned data. And in ANY case where stored procedures are involved, you have to use the methods above otherwise to you get error.
I think the reason is, that in stored procedures you can execute two or more SELECTs.

I already tried to find the location in the httpd sources where a fix is needed, but it seems to me that httpd is using the apr db driver interface.
Maybe the fix has to be done there and not in httpd source, but I'm not sure.

Regards
Torge

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_authn_dbd: Stored procedures not supported ... "Commands out of sync; you can't run this command now"

Posted by Edgar Pettijohn <ed...@pettijohn.no-ip.biz>.
On 06/29/2014 09:37 AM, Edgar Pettijohn wrote:
> On 06/29/2014 07:25 AM, Torge Riedel wrote:
>> Hi,
>>
>> I'm having a server installed with Apache 2.2 (Ubuntu LTS 12.04) and I
>> used mod_authn_dbd as documented here
>>
>> http://httpd.apache.org/docs/2.2/mod/mod_authn_dbd.html
>>
>> to check the permissions.
>>
>> Since I use a MySQL database
>>
>> DBDriver mysql
>>
>> is set.
>> Since there is already an existing user management on a different
>> server with access restrictions, the only way to use it is via a
>> stored procedure, thus
>>
>> AuthDBUserPWQuery "CALL queryUser(%s)"
>>
>> is defined like this.
>> But this is a problem, since MySQL is - let's say - a little bit
>> special when performing a query which is a call to a stored procedure. If
>> you just perform the query and fetch the result, the next query within
>> the same connection will fail with "Commands out of sync; you can't
>> run this command now" error.
>>
>> The reason is that when performing a query with a call to a stored
>> procedure you must take result sets into account like you do when
>> doing a multi-query.
>>
>> Multi-Query:
>>
>> "SELECT * FROM tUsers1; SELECT * FROM tUsers2;"
>>
>> returns in MySQL two result sets and you have to use
>>
>> mysql_use_result()
>> mysql_store_result()
>> mysql_free_result()
>>
>> to properly handle the returned data. And in ANY case where stored
>> procedures are involved, you have to use the methods above otherwise
>> to you get error.
>> I think the reason is, that in stored procedures you can execute two
>> or more SELECTs.
>>
>> I already tried to find the location in the httpd sources where a fix
>> is needed, but it seems to me that httpd is using the apr db driver
>> interface.
>> Maybe the fix has to be done there and not in httpd source, but I'm
>> not sure.
>>
>> Regards
>> Torge
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
> I had this issue before and I can't remember how I fixed it.  If you
> could provide more of your httpd.conf It might remind me.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
And httpd-error.log snippets.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_authn_dbd: Stored procedures not supported ... "Commands out of sync; you can't run this command now"

Posted by Edgar Pettijohn <ed...@pettijohn.no-ip.biz>.
On 06/29/2014 07:25 AM, Torge Riedel wrote:
> Hi,
>
> I'm having a server installed with Apache 2.2 (Ubuntu LTS 12.04) and I
> used mod_authn_dbd as documented here
>
> http://httpd.apache.org/docs/2.2/mod/mod_authn_dbd.html
>
> to check the permissions.
>
> Since I use a MySQL database
>
> DBDriver mysql
>
> is set.
> Since there is already an existing user management on a different
> server with access restrictions, the only way to use it is via a
> stored procedure, thus
>
> AuthDBUserPWQuery "CALL queryUser(%s)"
>
> is defined like this.
> But this is a problem, since MySQL is - let's say - a little bit
> special when performing a query which is a call to a stored procedure. If
> you just perform the query and fetch the result, the next query within
> the same connection will fail with "Commands out of sync; you can't
> run this command now" error.
>
> The reason is that when performing a query with a call to a stored
> procedure you must take result sets into account like you do when
> doing a multi-query.
>
> Multi-Query:
>
> "SELECT * FROM tUsers1; SELECT * FROM tUsers2;"
>
> returns in MySQL two result sets and you have to use
>
> mysql_use_result()
> mysql_store_result()
> mysql_free_result()
>
> to properly handle the returned data. And in ANY case where stored
> procedures are involved, you have to use the methods above otherwise
> to you get error.
> I think the reason is, that in stored procedures you can execute two
> or more SELECTs.
>
> I already tried to find the location in the httpd sources where a fix
> is needed, but it seems to me that httpd is using the apr db driver
> interface.
> Maybe the fix has to be done there and not in httpd source, but I'm
> not sure.
>
> Regards
> Torge
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
I had this issue before and I can't remember how I fixed it.  If you
could provide more of your httpd.conf It might remind me.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org