Uploaded image for project: 'appNG'
  1. appNG
  2. APPNG-2173

Call DriverManager.registerDriver() only once on startup

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Done
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.17.1
    • Component/s: appng-core
    • Labels:

      Description

      As of JDBC Spec, a java.sql.Driver must register itself at the Drivermanager:

      9.2 The Driver Interface
      JDBC drivers must implement the Driver interface, and the implementation must
      contain a static initializer that will be called when the driver is loaded. This initializer registers a new instance of itself with the DriverManager, as shown in CODE EXAMPLE 9-1

      public class AcmeJdbcDriver implements java.sql.Driver {
        static {
          java.sql.DriverManager.registerDriver(new AcmeJdbcDriver());
        }
      ...
      }
      

      CODE EXAMPLE 9-1
      Example static initializer for a driver implementing java.sql.Driver

      When a Driver implementation is loaded, the static initializer will automatically
      register an instance of the driver.

      But since we have to deal with different, reloadable applications (appNG and appNGizer), we should register the Driver once when starting those.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mueller.matthias Matthias Müller
                Reporter:
                mueller.matthias Matthias Müller
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: