I have tried many different variations of the code below (including extracting the Database connection details into the tag), but no matter what I do, the table is still created in the wrong database.
I have also tried to execute the "use autofi" database, but that does not work either and the tables are still created in a different database.
<plugin>
<!-- Used to automatically drop (if any) and create a database prior to running integration test cases. -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.5</version>
</dependency>
</dependencies>
<configuration> <!-- I'VE TRIED TAKING THIS OUT AS WELL -->
<!-- common configuration shared by all executions -->
<url>jdbc:mysql://localhost:3306/test</url>
<driver>com.mysql.jdbc.Driver</driver>
<username>root</username>
<password>root</password>
</configuration>
<executions>
<execution>
<!-- and finally run the schema creation script we just made with the hibernate3-maven-plugin -->
<id>create-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<url>jdbc:mysql://localhost:3306/AUTOFI</url>
<driver>com.mysql.jdbc.Driver</driver>
<username>root</username>
<password>root</password>
<srcFiles>
<srcFile>src/test/resources/sql/schema.sql</srcFile>
</srcFiles>
<onError>continue</onError>
</configuration>
</execution>
<!-- drop db after test -->
<execution>
<id>drop-db-after-test</id>
<phase>test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<url>jdbc:mysql://localhost:3306/test</url>
<driver>com.mysql.jdbc.Driver</driver>
<username>root</username>
<password>root</password>
<autocommit>true</autocommit>
<sqlCommand>drop database AUTOFI;</sqlCommand>
</configuration>
</execution>
</executions>
</plugin>
I have used the maven-sql-plugin examples as a template and that did not work either.
What am I doing wrong?
Thanks, Sean