GithubHelp home page GithubHelp logo

jdbc-mysql's Introduction

MySQL JDBC Connector

This project packages MySQL JDBC driver into a single JAR that could be used as dependency. It adds the MySQL JDBC connector version to class qualified names, so you can use several jdbc versions simultaneously:

<dependency>
    <groupId>com.stratio.connectors</groupId>
    <artifactId>mysql-jdbc-8.0.30</artifactId>
    <version>${mysql.stratio.version}</version>
</dependency>
<dependency>
    <groupId>com.stratio.connectors</groupId>
    <artifactId>mysql-jdbc-5.1.42</artifactId>
    <version>${mysql.stratio.old.version}</version>
</dependency>

And then you can do programmatically:

import java.sql.{Connection, DriverManager => SQLDriverManager}
import scala.jdk.CollectionConverters.enumerationAsScalaIteratorConverter

// register driver for mysql jdbc version 8.0.30
SQLDriverManager.registerDriver(new com.mysql8030.cj.jdbc.Driver())
// use driver 8.0.30
// Unregister driver for jdbc:mysql://
SQLDriverManager.getDrivers.asScala
  .filter(_.acceptsURL("jdbc:mysql://"))
  .toList
  .foreach(SQLDriverManager.deregisterDriver)
// register driver for mysql jdbc version 5.1.42
SQLDriverManager.registerDriver(new com.mysql5142.jdbc.Driver())
// use driver 5.1.42

Some dependencies have been relocated to avoid conflicts with other modules used in Stratio, but all of them are included in the final fatjar.

Artifacts

Releases can be found in Stratio Nexus.

Compatibility matrix:

Branch MySQL Driver Class Notes
branch-5.1.42-1.0 <5.7 com.mysql.jdbc.Driver
branch-8.0.30-1.0 โ‰ฅ5.7 com.mysql.cj.jdbc.Driver

Developers

Modify the following line in the pom.xml file with the desired version:

<mysql.version>5.1.42</mysql.version>

Check the relocations in the file pom.xml. They are at the end of the file, in the Shade plugin. It is important to test the final JAR in Crossdata to make sure there are no conflicts.

To build the JAR run:

mvn package 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.