Removing the "SET FOREIGN_KEY_CHECKS=0" resolved the issue in my create table
statement. Now I'm getting pretty much the same error in my insert test data
script. The strange thing is, when I embed this sql between the
<transaction></transaction> tags it runs, but when I specify a file using
the src attribute of transaction or sql elements I get the error included
below. I've modifying the SQL statements and trimming it down to a bare
minimum of only inserting two not null columns in one table, but no luck
with the src. Is it something I've over look again?

--
-- Data for the `certifications` table  (LIMIT 0,500)
--

INSERT INTO `certifications` (`certification_id`, `provider_id`,
`verifier_id`, `dateCreated`, `dateVerified`, `certName`, `description`)
VALUES
  (60001,20001,20002,'2009-11-01 12:00:00','2009-11-19
12:00:00','Cert1','Description of Cert1'),
  (60002,20004,20002,'2009-11-01 12:00:00','2009-11-19
12:00:00','Cert2','Description of Cert1'),
  (60003,20006,20002,'2009-11-01 12:00:00','2009-11-19
12:00:00','Cert3','Description of Cert3'),
  (60004,20007,20002,'2009-11-01 12:00:00','2009-11-19
12:00:00','Cert4','Description of Cert4');

COMMIT;

database.testdata:
      [sql] Executing resource:
C:\dev\Projects\ITeezy\MySQL\ITeezy\0.1.0\test-d
ata.sql
      [sql] Failed to execute:  ?-- SQL Manager 2007 for MySQL 4.2.0.2
      [sql]    INSERT INTO `certifications` (`certification_id`,
`provider_id`,
`verifier_id`, `dateCreated`, `dateVerified`, `certName`, `description`)
VALUES
(60001,20001,20002,'2009-11-01 12:00:00','2009-11-19
12:00:00','Cert1','Descript
ion of Cert1'), (60002,20004,20002,'2009-11-01 12:00:00','2009-11-19
12:00:00','
Cert2','Description of Cert1'), (60003,20006,20002,'2009-11-01
12:00:00','2009-1
1-19 12:00:00','Cert3','Description of Cert3'),
(60004,20007,20002,'2009-11-01 1
2:00:00','2009-11-19 12:00:00','Cert4','Description of Cert4')

BUILD FAILED
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 '?-- SQL Manager 2007 for MySQL 4.2.0.2
   INSERT INTO `certifications` (`certifi' at line 1
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)

        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
        at com.mysql.jdbc.Util.getInstance(Util.java:381)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1031)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2537)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2466)
        at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:735)
        at org.apache.tools.ant.taskdefs.SQLExec.execSQL(SQLExec.java:565)
        at
org.apache.tools.ant.taskdefs.SQLExec.runStatements(SQLExec.java:535)



antoinell wrote:
> 
> Hello,
> 
> maybe "SET FOREIGN_KEY_CHECKS=0" is not valid for a JDBC connection.
> 
> There are some vendor specific SQL instructions which are not valid
> inside JDBC.
> 
> The ant sql task is a wrapper around JDBC.
> 
> Maybe the task would need to be extended somehow to allow this kind of
> settings.
> 
> Regards,
> 
> Antoine
> 
> 
> mtbvang wrote:
>> Hi,
>>
>> I am getting the following error when using the
>> /mysql-connector-java-5.1.10-bin.jar in an Ant 1.7 SQL task. For some
>> reason
>> a ? is being placed at the beginning of my comment and sql statement
>> lines.
>> I've included the error from the cmd prompt and my and tasks below. Any
>> one
>> know what's going on?
>>
>>
>> C:\dev\Projects\project-name>ant database.create
>> Buildfile: build.xml
>> Trying to override old definition of datatype resources
>>
>> database.create:
>> [sql] Executing resource:
>> C:\dev\Projects\project-name\MySQL\project\0.1.0\project-name
>> .sql
>> [sql] Failed to execute: ?-- SQL Manager 2007 for MySQL 4.2.0.2
>> [sql] SET FOREIGN_KEY_CHECKS=0
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/SQl-task-error---A---placed-at-beginning-of-lines-of-sql-file-tp27137341p27139431.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to