You can simply define all of the configuration
within each individual execution
section and configure as required. Instead of having a shared configuration.
So here is an example to connect to two different HSQLDB databases:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.9</version>
</dependency>
<!-- you could add dependencies to other database drivers here -->
</dependencies>
<executions>
<!-- execution against database 1 -->
<execution>
<id>database1</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<!-- specific configuration for execution against database1 -->
<configuration>
<driver>org.hsqldb.jdbcDriver</driver>
<url>jdbc:hsqldb:hsql://localhost:9999/database1</url>
<username>sa</username>
<password></password>
<sqlCommand>select count(TYPE_NAME) from INFORMATION_SCHEMA.SYSTEM_TABLES</sqlCommand>
</configuration>
</execution>
<!-- execution against database 2 -->
<execution>
<id>database2</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<!-- specific configuration for execution against database2 -->
<configuration>
<driver>org.hsqldb.jdbcDriver</driver>
<url>jdbc:hsqldb:hsql://localhost:8888/database2</url>
<username>sa</username>
<password></password>
<sqlCommand>select count(TYPE_NAME) from INFORMATION_SCHEMA.SYSTEM_TABLES</sqlCommand>
</configuration>
</execution>
</executions>
</plugin>