Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-473

MariaDB Connector creates server prepared statements even when useServerPrepStmts=false

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 1.6.0, 2.0.1
    • 2.0.3, 1.6.2
    • Other
    • None
    • All operating systems.

    Description

      I've encountered an issue that prevents us from using the MariaDB Connector/J. When I use the MariaDB Connector it issues prepared statements on the server even though I've disabled those with useServerPrepStmts=false URL parameter. Here's the full list of URL parameters we use: cachePrepStmts=true&useServerPrepStmts=false&prepStmtCacheSize=250&prepStmtCacheSqlLimit=2048

      The prepared statements issued on the server are problematic for us, since we are using thousands of connections to the database and thus easily exceed the maximum number of server prepared statements that are specified with max_prepared_stmt_count variable. So after running our application for a while, I see the following error:
      Error preparing query: Can't create more than max_prepared_stmt_count statements (current value: 16382)

      I've been testing with MariaDB Connector 1.6.0 and comparing the results using MySQL Connector 5.1.41.

      Our application uses Apache Commons DbUtils 1.6 to access the database. The core class on DbUtils is QueryRunner, which you use to make queries to the database.

      I've been tracking the source of the server prepared statements to following call path:
      QueryRunner.query() calls PreparedStatement.getParameterMetaData(), which causes MariaDB Connector to issue a prepared statement on the server (Com_stmt_prepare variable goes up). This behaviour is different from MySQL Connector, where PreparedStatement.getParameterMetaData() does not issue a prepared statement on the server. So if I run the same code with disableMariaDbDriver=true URL parameter which forces the use of MySQL Connector, I observe no prepared statements on the server (Com_stmt_prepare variable value remains the same).

      I'd like to use MariaDB Connector, as that's the recommended connector to use with Aurora RDS. However the use of server prepared statements don't allow me to take the MariaDB Connector into use.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            tojoko Tomi Joki-Korpela
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.