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