Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-17380

The MySQL database fails to be recognized under some conditions when using the "com.mysql.cj.jdbc.Driver" driver class

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 12.5-rc-1, 11.10.6
    • 11.10
    • Old Core
    • None
    • Unknown
    • N/A
    • N/A

    Description

      This is because we have some very fragile code that tries to recognize the DB based on the JDBC driver class used. Thus if there are several driver classes that can be used, we'll fail to create or delete subwikis properly (these are our main 2 use cases for which we need to recognize the DB name but there can be others). We should change that. Actually, we're not even supposed to code this since JDBC offers a way to provide the DB name: http://www.enseignement.polytechnique.fr/informatique/Java/1.8/java/sql/DatabaseMetaData.html#getDatabaseProductName--

      I guess there was a problem but the code doesn't explain it in HibernateStore:

          /**
           * Retrieve the current database product name.
           * <p>
           * Note that the database product name is cached for improved performances.
           * </p>
           *
           * @return the database product name, see {@link DatabaseProduct}
           * @since 4.0M1
           */
          public DatabaseProduct getDatabaseProductName()
      

      We need to explain why and better fix the code to not depend on something fragile. This needs a new issue. FTM I'm going to quickly fix the bug and add support for "com.mysql.cj.jdbc.Driver", till I understand better why we're doing what we're doing.

      Attachments

        Activity

          People

            vmassol Vincent Massol
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: