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.