I'm having an issue with my Arquillian tests.
In my deploy() method, I've got:
final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test.war")
.addAsWebInfResource(new File("src/main/setup/glassfish-resources.xml"), "glassfish-resources.xml")
.addAsResource(new File("src/main/resources/META-INF/persistence.xml"), "META-INF/persistence.xml")
Note the "create_mydb.sql" added as a resource.
The issue I'm encountering is when the line in the MySQL script
CREATE TRIGGER my_trg ...
is run, I get an error in my NetBeans 8.0.2 console:
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 'DELIMITER |CREATE TRIGGER my_trg' at line 1
The interesting thing is that when I run the script on my local MySQL database server, it runs without a hitch. I'm trying to isolate the problem, so I'm trying my hand at starting a Discussion here on the forums. So, the error seems to happen when the parser reads the line where I want to start defining my multi-statement trigger. I did some research before posting here, and I have a hunch that the parser (I'm not actually sure what the parser is called) does not know what the DELIMITER keyword is, so it flags it as an error. I've read that that keyword may be only known to the mysql program.
If I run the test having removed the trigger in my script, it's able to start testing, though my database depends upon this trigger in order to function properly.
How does one get around to defining a multi-statement MySQL trigger when loading a script like this?
Need any more info? Let me know! I'm very interested in learning how to overcome this issue, if it's possible at all.