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

Database connection failing on android

    XMLWordPrintable

Details

    Description

      During programming an android app in Android Studio I encountered following bug:

      When trying to connect to my MariaDB database via JDBC-Connector I receive a PatternSyntaxException.

      It occurrs under: src/main/java/org/mariadb/jdbc/Connection.java , when the following Object is created (line 31):

      private static final Pattern CALLABLE_STATEMENT_PATTERN;
      

      Following line in my code is throwing the error:

      val connection = DriverManager.getConnection(jdbcURL, username, password)
      

      The error:

      Caused by: java.util.regex.PatternSyntaxException: Syntax error in regexp pattern near index 185
                                                                                                          ^(\s*\{)?\s*((\?\s*=)?(\s*/\*([^*]|\*[^/])*\*/)*\s*call(\s*/\*([^*]|\*[^/])*\*/)*\s*((((`[^`]+`)|([^`}]+))\.)?((`[^`]+`)|([^`}(]+)))\s*(\(.*\))?(\s*/\*([^*]|\*[^/])*\*/)*\s*(#.*)?)\s*(}\s*)?$
                                                                                                                                                                                                                                                                                                   ^
      

      The syntax error occurrs at the last right curly brace of the string ('}').
      As you can read in the android documentation (https://developer.android.com/reference/java/util/regex/Pattern.html#behavior-starting-from-api-level-10-android-2.3), android does not support literal right braces which are not escaped.
      So you need to somehow escape this right curly brace ('}') otherwise a database connection between android and MariaDB is impossible.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            KrabimannBardo KrabimannBardo
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.