繁体   English   中英

MySQL 工作台和 mysql-connector-java-5.1.15 的区别

[英]Difference between MySQL workbench and mysql-connector-java-5.1.15

我正在尝试使用 mysql-connector-java-5.1.15 通过 ant 任务在 mysql 服务器上运行以下 sql 脚本,但它不会在第三个错误上工作我可以从 ant 让其他脚本正常工作,所以这不是连接问题。

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 'DROP TABLE IF 
EXISTS `tmp_cui_desc`;
CREATE TABLE `tmp_cui_desc` (
    CUI CHAR(8' at line 15

奇怪的是,该脚本在连接到同一服务器的 MySql 工作台(v5.2.31)中工作得非常好。 为什么会这样? 数据库是 latin1,字符集系统是 uft8。 这可能是问题的一部分吗? 如果是这样,我需要做什么来修复它?

非常感谢罗布的任何帮助。


USE umls;

/*
 * creates a summary view of the umls_mrconso table which abstracts most of the detail from atoms to concepts
 * this is a table with a single row per CUI
 * 
 */

/*
 * Create a temporary table based on the sources of a given cui
 */
DROP TABLE IF EXISTS tmp_cui_sabs;
CREATE TABLE tmp_cui_sabs (
    CUI CHAR(8) NOT NULL, 
    SABS VARCHAR(255), 
    PRIMARY KEY (CUI)
)
SELECT 
    u.CUI as CUI, 
    GROUP_CONCAT(DISTINCT u.SAB ORDER BY u.SAB ASC SEPARATOR '|') as SABS
FROM umls_mrconso u 
GROUP BY u.CUI;

/* 
 * Create a temporary table containing the best available description for any given cui
 */
DROP TABLE IF EXISTS tmp_cui_desc;
CREATE TABLE tmp_cui_desc (
    CUI CHAR(8) NOT NULL, 
    TERM VARCHAR(255), 
    PRIMARY KEY (CUI)
)
SELECT 
    u.CUI as CUI, 
    MIN(u.STR) as TERM 
FROM umls_mrconso u 
WHERE u.ISPREF='Y' 
AND u.LAT='ENG' 
AND u.TS='P' 
GROUP BY u.CUI;

/*
 * Create a permanent table as the join of the 2 temporary tables
 * contains a preferred description, and all the sources that map to this cui,
 * as well as the CUI itself.
 * TODO: could be useful to include semantic type info here as well?
 */
DROP TABLE IF EXISTS bmj_cui_summary;
CREATE TABLE bmj_cui_summary (
    CUI CHAR(8) NOT NULL, 
    TERM VARCHAR(255), 
    SABS VARCHAR(255), 
    PRIMARY KEY (CUI)
)
SELECT 
    sabs.CUI as CUI, 
    LOWER(descs.TERM) as TERM, 
    sabs.SABS as SABS 
FROM 
    tmp_cui_sabs sabs, 
    tmp_cui_desc descs 
WHERE sabs.CUI=descs.CUI;

/*
 * clean up tmp tables
 */
DROP TABLE IF EXISTS tmp_cui_sabs;
DROP TABLE IF EXISTS tmp_cui_desc;

只是一个猜测,但您可能每个查询只能发送一个命令。 所以将它们分开; 并单独查询。 我用不同的语言遇到了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM