Using JDBC in PowerBuilder to connect to MYSQL cannot use COUNT (*) MAX () function processing _ MySQL

Source: Internet
Author: User
Error in connecting to MYSQL using JDBC in PowerBuilder: longll_countProfilemysqlSQLCADBMS Connect to MYSQL using JDBC in PowerBuilder

Errors:

 long ll_count // Profile mysqlSQLCA.DBMS = "JDBC"SQLCA.LogPass = "123"SQLCA.LogId = "root"SQLCA.AutoCommit = FalseSQLCA.DBParm = "Driver='com.mysql.jdbc.Driver',URL='jdbc:mysql://localhost:3306/his' " connect using sqlca; select count(*) into :ll_count from yk_cddz;

An error is reported for a very simple statement!

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*) from yk_cddz' at line 1

No one wrote a post for Baidu, so I checked the MYSQL User Manual and finally

Function Name Parsing and Resolution
If you use C language APIs, you can specify the CLIENT_IGNORE_SPACE parameter. The ODBC driver also has the Ignore Space Afrer Function Names option, but this option is not available in official JDBC. Therefore, you must use the MYSQ statement to set it.

Settings in Powerbuilder

 string sql   long ll_count sql = "SET sql_mode = 'IGNORE_SPACE' "  EXECUTE IMMEDIATE :sql ; select count(*) into :ll_count from yk_cddz;

In this way, there will be no errors and you will get the correct results. here, I will write a post, hoping that you can learn from friends who have the same problems.

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.