测试积点老人 发表于 2021-8-27 13:33:52

sql执行报错 但在Navicat可以执行


<select id="putAppAnalysisTaskOutfile" >
      load data local infile #{putFilePath}
      into table app_analysis_task
      fields terminated by '|' lines terminated by '\n'
      (<include refid="appAnalysisTaskUsedColumns"/>)
    </select>mybatis执行报错,但sql在Navicat可以执行org.springframework.jdbc.BadSqlGrammarException:Error querying database. Cause: java.sql.SQLSyntaxErrorException: The used command is not allowed with this MySQL version
The error may exist in file
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: load data local infile ? into table app_analysis_task fields terminated by '|' lines terminated by '\n' ( name,market,app_num_threshold,create_time,end_time,process_percent,status,type_num,total_app_num,app_ratio,download_order )
Cause: java.sql.SQLSyntaxErrorException: The used command is not allowed with this MySQL version
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: The used command is not allowed with this MySQL version

SHOW VARIABLES LIKE '%local%';
local_infile ON

bellas 发表于 2021-8-30 09:42:45

参考下这个链接https://ask.csdn.net/questions/1061849

海海豚 发表于 2021-8-30 10:00:49

区别在于你在navicat中插入的是一条,那最外面的select * from去掉改成下面这样试试。另外insert into 表 select 语句不管在oracle还是mysql都是可以省略values关键字的

qqq911 发表于 2021-8-30 11:13:46

换个工具试试看

litingting0214 发表于 2021-8-30 16:40:25

那就在 Navicat 中用

jingzizx 发表于 2021-8-30 17:12:20

语法有差别把
页: [1]
查看完整版本: sql执行报错 但在Navicat可以执行