水表 2015-08-22 07:18 采纳率: 0%
浏览 2515

java用ant.jar工具类执行sql脚本遇到问题

最近在研究用工具类ant.jar执行sql脚本文件,一般对数据和字段的操作都无问题,但当要执行生成触发器或者存储过程时却出错,有大神做过这方面的吗?或者用其他方法可以执行能生成存储过程和触发器的sql脚本?求解!新人无币,望见谅~

 Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '' at line 1
    at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:672)
    at execSQL.AntExecSql.main(AntExecSql.java:38)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '' at line 1
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
    at com.mysql.jdbc.Util.getInstance(Util.java:384)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3562)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3494)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2690)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2619)
    at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:783)
    at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:626)
    at org.apache.tools.ant.taskdefs.SQLExec.execSQL(SQLExec.java:775)
    at org.apache.tools.ant.taskdefs.SQLExec.runStatements(SQLExec.java:745)
    at org.apache.tools.ant.taskdefs.SQLExec$Transaction.runTransaction(SQLExec.java:1055)
    at org.apache.tools.ant.taskdefs.SQLExec$Transaction.access$000(SQLExec.java:985)
    at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:653)
    ... 1 more

  • 写回答

3条回答 默认 最新

  • yuke198907 2015-08-25 05:07
    关注

    错误信息是什么呢?给出来看看啊

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看