Problem with autocommit in ANT SQL task

I have an SQL script and want to apply it witn ANT task. This script clears out schema, creates new tables and views.

The ANT defined task as follows:

<sql driver="com.mysql.jdbc.Driver"
        url="jdbc:mysql://host:3306/smth"
        userid="smth"
        password="smth"
        expandProperties="false"
        autocommit="true"             
        src="all.sql"
         >
</sql>

When this task launches, it shows in log that tables are cleared and created. But when it tries to create first view, it fails with:

Failed to execute:  CREATE VIEW component... AS SELECT component_raw.id AS
MySQLSyntaxErrorException: Table 'component_raw' doesn't exist

I have no idea why it fails here. Running this all.sql from MySQL query browser gives no errors. When I launched ANT with -v option, I didn't see any "COMMIT" messages..

Please, help to resolve the problem.


I had completely the same issue, it turned out that I had comments in my sql files started with # . After replacing # for *-- * everything works fine.

链接地址: http://www.djcxy.com/p/44338.html

上一篇: ANT sql任务:如何运行SQL和PL / SQL并注意执行失败?

下一篇: ANT SQL任务中的自动提交问题