Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues connecting to mariadb linux socket #2136

Closed
HiddenKn opened this issue Sep 6, 2018 · 3 comments
Closed

Issues connecting to mariadb linux socket #2136

HiddenKn opened this issue Sep 6, 2018 · 3 comments

Comments

@HiddenKn
Copy link

@HiddenKn HiddenKn commented Sep 6, 2018

Which version and edition of Flyway are you using?

Flyway Community Edition 5.1.4 by Boxfuse

If this is not the latest version, can you reproduce the issue with the latest one as well?

(Many bugs are fixed in newer releases and upgrading will often resolve the issue)
I think it's the latest release.

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Command-line

Which database are you using (type & version)?

Server version: 10.1.34-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04

Which operating system are you using?

Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic

What did you do?

(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)


alice@fun1:/home/ss13/Daedalus-of-Freedom$ /opt/flyway-5.1.4/flyway -n -user=alice -url=jdbc:mariadb://localhost:3306/mysql?localSocket=/var/run/mysqld/mysqld.sock migrate
Flyway Community Edition 5.1.4 by Boxfuse

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/LastErrorException
        at org.mariadb.jdbc.internal.util.Utils.createSocket(Utils.java:543)
        at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connect(AbstractConnectProtocol.java:433)
        at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1101)
        at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:494)
        at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:150)
        at org.mariadb.jdbc.Driver.connect(Driver.java:86)
        at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnectionFromDriver(DriverDataSource.java:421)
        at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnection(DriverDataSource.java:384)
        at org.flywaydb.core.internal.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:51)
        at org.flywaydb.core.internal.database.DatabaseFactory.createDatabase(DatabaseFactory.java:70)
        at org.flywaydb.core.Flyway.execute(Flyway.java:1227)
        at org.flywaydb.core.Flyway.migrate(Flyway.java:910)
        at org.flywaydb.commandline.Main.executeOperation(Main.java:161)
        at org.flywaydb.commandline.Main.main(Main.java:108)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.LastErrorException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 14 more
What did you expect to see?

That it connected to the database

What did you see instead?

The error above.

@HiddenKn HiddenKn changed the title Issues connecting to mysql socket Issues connecting to mariadb linux socket Sep 6, 2018
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Sep 7, 2018

Thanks for reporting. It appears the MariaDB JDBC driver optionally requires JNA (which Flyway doesn't ship with) and this must be a case where it is used.

Can you try downloading https://search.maven.org/remotecontent?filepath=net/java/dev/jna/jna-platform/4.5.2/jna-platform-4.5.2.jar and https://search.maven.org/remotecontent?filepath=net/java/dev/jna/jna/4.5.2/jna-4.5.2.jar, adding these 2 jar files to Flyway's drivers directory and then try to connect again to see if this fixes the issue?

@HiddenKn
Copy link
Author

@HiddenKn HiddenKn commented Sep 7, 2018

Works perfectly! Thank you!

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Sep 7, 2018

Thanks for testing. Then we'll include these out of the box, starting with Flyway 5.2.

@axelfontaine axelfontaine added this to the Flyway 5.2.0 milestone Sep 7, 2018
axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Sep 18, 2018
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.