嗨我正試圖從文件加載數據到MySQL數據庫使用休眠。休眠+ mysql +加載文件中的數據
這裏是查詢,
session.createSQLQuery("LOAD DATA INFILE E:/uploaded/NumSerie/NS/NumSerie.txt INTO TABLE prod CHARACTER SET latin1 FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n' IGNORE 1 LINES;").executeUpdate();
,但我得到以下錯誤,
org.hibernate.QueryException: Space is not allowed after parameter prefix ':' [LOAD DATA INFILE E:/uploaded/NumSerie/NS/NumSerie.txt INTO TABLE prod CHARACTER SET latin1 FIELDS TERMINATED BY ';' LINES TERMINATED BY '
' IGNORE 1 LINES;]
at org.hibernate.engine.query.ParameterParser.parse(ParameterParser.java:92)
at org.hibernate.engine.query.ParamLocationRecognizer.parseLocations(ParamLocationRecognizer.java:75)
我怎麼能改寫這個查詢,以便這是正確執行?
在此先感謝!
試圖逃跑:用\: – Satya 2012-04-27 13:02:12
嗨薩蒂亞,我試過了,但它沒有工作: ( – user732362 2012-04-27 13:22:03
試試這個:LINES TERMINATED BY'\ r \ n' – Satya 2012-04-27 13:25:50