Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-984

Update bundles SQLite JDBC driver

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None

      CraftBukkit and Spigot both bundle sqlite-jdbc 3.7.2 that was release in 2010. I would like to request an update to the current version, 3.8.x.

      sqlite-jdbc includes the JDBC driver implementation that communicates with the database as well as the SQLite binaries. Updating sqlite-jdbc would also update the SQLite version uses by plugins using the driver to 3.8.x. It is worth noting that due to JDBC's design, it is not possible for a plugin to bundle its own version of the driver; drivers are always global (at least within the same class loader).

      Benefits of an update

      SQLite

      SQLite 3.8 is up to 50% faster than 3.7 due to a new query planner. There are also lots of new features, improvements and bug fixes, see the official changelog. As far as SQLite goes, there is absolutely no reason to use 3.7 now.

      JDBC driver

      The JDBC driver bundled with sqlite-jdbc 3.7.2 is still a JDBC 3.0 implementation (JDBC 3.0 was release with Java4). And not even all of JDBC 3.0's methods are implemented - most prominently, Connection.setSavepoint(), Connection.setSavepoint(String), Connection.releaseSavepoint(), Connection.rollback() are missing, even though SQLite supports Savepoints. This is a major problem when writing transactions. JDBC 4.0 (released with Java5) additions are completely missing: Connection.isValid() is not implemented, as well as several more technical requirements such as PooledDataSource or PooledConnection.

      Potential problems

      SQLite

      SQLite 3.8.x is fully backwards compatible, there should not be any problems. However, SQLite does not guarantee forward compatibility. I am not aware of a problem that resulted from downgrading a SQLite database from 3.8.x to 3.7.x, but this should be kept in mind.

      JDBC driver

      The code signature of the driver has massively changed between 3.7 and 3.8. However they should not affect as as no one should directly reference the driver and there is no reason to do so.

      The way JDBC is designed, developers only work with the interfaces of JDBC that are bundled directly with the JRE and implemented by drivers. A connection to a database is acquired via the{{DriveManager}} using the appropriate DSN and credentials or via a DataSource object. These are either acquired from the AppServer (in JEE) or from a connection-pool library that implements its own.
      I am mentioning this, because there is a certain chance that some users rely on the DataSource implementations bundled directly by drivers which are normally meant for consumption by the AppServer. For example, there is a project called MiniConnectionPool that implements a connection-pool on top of DataSource implementations. To use it, one must directly initialize DataSource implementations bundled by drivers and therefore directly reference a driver. AuthMeReloaded uses the MiniConnectionPool, although only for MySQL.
      However I think that these potential problems can be ignored:

      1. They are bad practice as outlined above.
      2. There are far better and more performant ways to implement connection-pooling using libraries such as Hikari-CP.
      3. Even if someone uses MiniConnectionPool, he absolutely should not use it for SQLite anyway due to SQLite's file locking that renders connection-pooling useless.

      I am open for discussion, perhaps something is not entirely clear or I have missed a point. If not, an update to the SQLite driver would be much appreciated. If needed I can write a PR myself, but I am not familiar with Spigot and the actual change only requires a small edit in the POM.

            Unassigned Unassigned
            TheE TheE
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: