1

In my ~/.bashrc:

export CLASSPATH=~/mysqljdbc/mysql-connector-java-5.1.21-bin.jar

CLASSPATH var is correct:

ray@ubuntu:~$ echo $CLASSPATH
/home/ray/mysqljdbc/mysql-connector-java-5.1.21-bin.jar

Trying to run it:

ray@ubuntu:/var/www/project$ sh ~/flyway-commandline-1.7/flyway.sh -driver=com.mysql.jdbc.Driver -user=root -p=password -url=jdbc:mysql://localhost:3306/project init
Flyway (Command-line Tool) v.1.7

FlywayException: Unable to instantiate jdbc driver: com.mysql.jdbc.Driver
Occured in com.googlecode.flyway.core.util.jdbc.DriverDataSource.<init>() at line 93

Any ideas why it can't find the driver for this?

Thanks!

1
  • I've now changed the error message of Flyway Command-Line as well, to make this easier to spot and fix. Commented Jul 21, 2012 at 10:52

1 Answer 1

2

Specifying -classpath or -cp overrides any setting of the CLASSPATH and this is done in flyway.sh According to flyway docs you have to store your mysql jdbc jar in jars folder (or just add it to JVM startup in flyway.sh).

Sign up to request clarification or add additional context in comments.

2 Comments

guys I am getting the same error as TJ but I am using maven. <plugin> <groupId>com.googlecode.flyway</groupId> <artifactId>flyway-maven-plugin</artifactId> <version>1.7</version> <configuration> <user>aa</user> <password>aa</password> <driver>com.mysql.jdbc.Driver</driver> <url>jdbc:mysql://localhost:3306/mydb</url> </configuration> </plugin>
[ERROR] Failed to execute goal com.googlecode.flyway:flyway-maven-plugin:1.7:migrate (default-cli) on project flywaydb: Flyway Error: com.googlecode.flyway.core.exception.FlywayException: Unable to instantiate jdbc driver: com.mysql.jdbc.Driver -> [Help 1]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.