Using JDBC Connection in PowerBuilder MySQL cannot use the count (*) MAX () function for processing

Source: Internet
Author: User



Using JDBC to connect MySQL in PowerBuilder



Error encountered:





 long ll_count 
// Profile mysql
SQLCA.DBMS = "JDBC"
SQLCA.LogPass = "123"
SQLCA.LogId = "root"
SQLCA.AutoCommit = False
SQLCA.DBParm = "Driver='com.mysql.jdbc.Driver',URL='jdbc:mysql://localhost:3306/his' " 
connect using sqlca; 

select count(*) into :ll_count from yk_cddz;








A very simple statement, unexpectedly error!





You have a error in your SQL syntax; Check the manual, corresponds to your MySQL server version for the right syntax to use near ' *) from Yk_cddz ' at line 1



Baidu found no one to write a post, so look at the MySQL user manual, finally in


The Function Name parsing and Resolution section has a description
If you use the C language API to operate, you can specify the client_ignore_space parameter, ODBC driver also has IGNORE SPACE afrer Function Names this option, But this option is not in the official JDBC. So, to use the MYSQ statement to set.








Settings in the PowerBuilder





 <span style="font-size:18px;">string sql  
 long ll_count
 sql = "SET sql_mode = 'IGNORE_SPACE' "  
EXECUTE IMMEDIATE :sql ; 
select count(*) into :ll_count from yk_cddz;</span>

This operation will not have errors, you can get the correct results, write a post here, hope to have the same problem friends can learn from.





Copyright NOTICE: This article for Bo Master original article, without Bo Master permission can be reproduced.



Using JDBC Connection in PowerBuilder MySQL cannot use the count (*) MAX () function for processing


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.