MySQL error:procedure Xmdk.query_all_plan can ' t return a result set in the given context

Source: Internet
Author: User

C + + call stored procedure failed! The following error occurred: MySQL error:procedure Xmdk.query_all_plan can ' t return a result set in the given context

which

XMDK is the database name,
Query_all_plan is the name of the stored procedure written by himself;

  

  

Error reason: connection to the database may be incorrect.

The database connection method that caused the error:

C + + Code
1
2
3
4
5
6
7
8
9
10
11
if(mysql_real_connect(M_mysql, Server_ip.c_str (),
User_name. C_str (),
User_password. C_str (),
Mysql_dbname. C_str (),
0,
NULL,
0) == NULL)
{
Debug_trace_error (wstr("Serverconnect_2,eer:mysql (%s) connection failed.,%s:%d"), Connectstr. C_str (), __wfunction__, __line__);
return -1;
}

Modify to the correct connection mode:

C + + Code
1
2
3
4
5
6
7
8
9
10
11
if(mysql_real_connect(M_mysql, Server_ip.c_str (),
User_name. C_str (),
User_password. C_str (),
Mysql_dbname. C_str (),
0,
NULL,
client_multi_statements) == NULL)
{
Debug_trace_error (wstr("Serverconnect_2,eer:mysql (%s) connection failed.,%s:%d"), Connectstr. C_str (), __wfunction__, __line__);
return -1;
}

Sure enough, by modifying the connection parameters (client_multi_statements) connected to the database, it's OK!

With client_multi_statements, You can execute multiple statements at once, and execute a stored procedure (many statements).

MySQL error:procedure Xmdk.query_all_plan can ' t return a result set in the given context

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.