Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flyway Unable to instantiate jdbc driver

Just starting out with Flyway and Spring 3.0. So far, all I did was add the Flyway dependency and plugin to my pom.xml. Next, I tried running mvn flyway:status in the command line. However, it complains that it is unable to instantiate the jdbc driver (I'm using postgres).

Does anybody know what might be causing this? I'm using Springsource Tool Suite to develop my app. The postgres driver is located under WEB-INF/lib/postgresql-9.1-902.jdbc4.jar

Any help is greatly appreciated! Thanks!

like image 617
OckhamsRazor Avatar asked Sep 03 '12 06:09

OckhamsRazor


People also ask

How do I connect to a JDBC database using Flyway?

The fully qualified classname of the jdbc driver to use to connect to the database. This must match the driver for the database type in the url you are using. If you use a driver class that is not shipped with Flyway, you must ensure that it is available on the classpath (see Adding to the classpath ).

How do I set up Flyway to connect to a DBM?

You need to tell Flyway which DBM you are using via the JDBC driver, the JDBC URL to the database, the database user to be used in Flyway operations, the password for that user, and the database schema to be acted upon.

Does Flyway support SQL Server DDL?

SQLServer support is a separate dependency for Flyway and will need to be added to your Java project to access these features. DDL exported by SQL Server can be used unchanged in a Flyway migration.

How do I set up Flyway?

The basic configuration of Flyway is simple. You need to tell Flyway which DBM you are using via the JDBC driver, the JDBC URL to the database, the database user to be used in Flyway operations, the password for that user, and the database schema to be acted upon.


1 Answers

For the Maven plugin to work you must:

Add this dependency to your project (or just the plugin):

<dependency>
    <groupId>postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.1-901-1.jdbc4</version>
</dependency>

and configure the plugin like this:

<plugin>
    <groupId>com.googlecode.flyway</groupId>
    <artifactId>flyway-maven-plugin</artifactId>
    <version>1.7</version>
    <configuration>
        <driver>org.postgresql.Driver</driver>
        <url>jdbc:postgresql://...</url>
        <user>...</user>
        <password>...</password>
    </configuration>
</plugin>
like image 68
Axel Fontaine Avatar answered Sep 18 '22 07:09

Axel Fontaine