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

Java Client's MySQLPreparedStatement.toString() does not print SQL statement, like Connector/J's class does

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 1.1.3
    • 1.1.4
    • None
    • None

    Description

      MySQL Connector/J's PreparedStatement class outputs the generated SQL Statement when toString() is called. This is used for logging in applications. Example of the output:

      com.mysql.jdbc.PreparedStatement@500fbfa2: SELECT id FROM table WHERE someRow='abc'

      As one can see, it is trivially to parse the SQL statement from the output of toString() - just get the string after the substring ": ". Or even more simple, just logging the output of toString() might suffice for some logs.

      I have an application which is originally written with Connector/J in mind. If I use Connector/J, I get useful log output - it even outputs the statement with the parameter values set.

      It would generally reduce cost for application developers if the MariaDB Java Client would output the statement that way, too - for example, the returned String could look like this:

      org.mariadb.jdbc.MySQLPreparedStatement@500fbfa2: SELECT id FROM table WHERE someRow='abc'

      Attachments

        Activity

          People

            wlad Vladislav Vaintroub
            dkessel Daniel Kessel
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.