我想通過使用mysql-connector-java-5.1.15的ant任務在mysql服務器上運行以下sql腳本,但它不起作用並且在第三個命令中出現以下錯誤。我可以讓其他腳本在螞蟻中正常工作,因此它不是連接問題。MySQL工作臺和mysql-connector-java-5.1.15之間的區別
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。這可能是問題的一部分嗎?如果是的話,我需要做些什麼來解決它?
非常感謝任何幫助 Rob。
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;
不知道jdbc,但通常您只能通過c-lib在一段時間內共享一條sql語句。 (我猜也是由jdbc使用的)。如果你使用ant,你不能直接調用mysql客戶端。例如'mysql -uusername -ppassword
Rufinus
2011-06-08 15:43:25