Home > Database > Mysql Tutorial > PowerBuilder中使用JDBC连接MYSQL无法使用COUNT(*)MAX()函数的处理_MySQL

PowerBuilder中使用JDBC连接MYSQL无法使用COUNT(*)MAX()函数的处理_MySQL

WBOY
Release: 2016-06-01 11:52:31
Original
1456 people have browsed it

PowerBuilder中使用JDBC连接MYSQL

遇到的错误:

 

 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;
Copy after login

很简单的一条语句,竟然报错了!

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

找了百度没有人写个贴子,于是查看MYSQL的使用手册,终于在

Function Name Parsing and Resolution小节有说明


如果是用C语言API来操作,可以指定CLIENT_IGNORE_SPACE 参数,ODBC驱动中也有Ignore Space Afrer Function Names 这个选项,但是官方的JDBC中的没有这个选项。所以,要使用MYSQ 语句来设置。

Powerbuilder中的设置

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

这样操作就不会有错误了,可以得到正确结果了,在这里写个贴子,希望有同样问题的朋友可以借鉴。

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template