51Testing软件测试论坛

标题: sql执行报错 但在Navicat可以执行 [打印本页]

作者: 测试积点老人    时间: 2021-8-27 13:33
标题: sql执行报错 但在Navicat可以执行

  1. <select id="putAppAnalysisTaskOutfile" >
  2.         load data local infile #{putFilePath}
  3.         into table app_analysis_task
  4.         fields terminated by '|' lines terminated by '\n'
  5.         (<include refid="appAnalysisTaskUsedColumns"/>)
  6.     </select>
复制代码

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

org.springframework.jdbc.BadSqlGrammarException:

  1. Error querying database. Cause: java.sql.SQLSyntaxErrorException: The used command is not allowed with this MySQL version
  2. The error may exist in file [E:xxxx.xml]
  3. The error may involve defaultParameterMap
  4. The error occurred while setting parameters
  5. 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 )
  6. Cause: java.sql.SQLSyntaxErrorException: The used command is not allowed with this MySQL version
  7. ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: The used command is not allowed with this MySQL version

  8. SHOW VARIABLES LIKE '%local%';
  9. local_infile ON
复制代码



作者: bellas    时间: 2021-8-30 09:42
参考下这个链接https://ask.csdn.net/questions/1061849
作者: 海海豚    时间: 2021-8-30 10:00
区别在于你在navicat中插入的是一条,那最外面的select * from去掉改成下面这样试试。另外insert into 表 select 语句不管在oracle还是mysql都是可以省略values关键字的
作者: qqq911    时间: 2021-8-30 11:13
换个工具试试看
作者: litingting0214    时间: 2021-8-30 16:40
那就在 Navicat 中用
作者: jingzizx    时间: 2021-8-30 17:12
语法有差别把




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2