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

JDBC driver adds extra .0 to DOUBLEs that MySQL driver doesn't

Details

    Description

      I have a table that stores DOUBLE values. Frequently these are non-decimal values.

      When I issue the following query via Workbench:

      select Order_Total from Orders
      

      Workbench gives me the expected results (importantly, so does the MySQL JDBC driver when connecting to a MySQL 5.6 database):

      1031
      20
      558
      1600
      626
      

      When I do the same via Connector/J to a MariaDB 10.1.29 database the string representation of the number via getString() adds a trailing .0 as follows:

      1031.0
      20.0
      558.0
      1600.0
      626.0
      

      I thought at first it might be a Connector/J or Mariadb server setting, but I can't find anything, so looks like incompatible behavior.

      Attachments

        Issue Links

          Activity

            diego dupin Diego Dupin added a comment - - edited

            Right, and this is inconsistent using option "useServerPrepStmts" that will not return the additional ".0".
            (That concerns FLOAT type the same way)

            diego dupin Diego Dupin added a comment - - edited Right, and this is inconsistent using option "useServerPrepStmts" that will not return the additional ".0". (That concerns FLOAT type the same way)
            diego dupin Diego Dupin added a comment -

            correction available in snapshot release :

            <repositories>
                <repository>
                    <id>sonatype-nexus-snapshots</id>
                    <name>Sonatype Nexus Snapshots</name>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </repository>
            </repositories>
             
            <dependencies>
                <dependency>
                    <groupId>org.mariadb.jdbc</groupId>
                    <artifactId>mariadb-java-client</artifactId>
                    <version>2.2.1-SNAPSHOT</version>
                </dependency>
            </dependencies>
            

            diego dupin Diego Dupin added a comment - correction available in snapshot release : <repositories> <repository> <id>sonatype-nexus-snapshots</id> <name>Sonatype Nexus Snapshots</name> <url>https: //oss.sonatype.org/content/repositories/snapshots</url> </repository> </repositories>   <dependencies> <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> <version> 2.2 . 1 -SNAPSHOT</version> </dependency> </dependencies>
            rdyas Robert Dyas added a comment -

            Great! Just tried it, and working as expected. Thank you.

            New Issue: I'll make a seperate thread if its an issue and not a misunderstanding:
            when i switched from 1.6.3 to 2.2.1 I get the error:

            SSL hostname verification failed : IPv4 host "35.224.113.70" doesn't correspond to certificate CN "si-mariadb-shared1-v1.parasql.com"
            

            My connect string includes the following and was connecting to a specific IP address:

            &useSSL=true&trustServerCertificate=false&serverSslCert= etc

            That setting under 2.2.1 throws an exception and the documentation states the following:

            disableSslHostnameVerification	When using ssl, the driver checks the hostname against the server's identity as presented in the server's certificate (checking alternative names or the certificate CN) to prevent man-in-the-middle attacks. This option permits deactivating this validation. Hostname verification is disabled when the trustServerCertificate option is set
            Default: false. Since 2.1.0
            

            It is unclear to me if set means set to true or false. It would seem that since I am connecting to an IP and verifying the CA that I don't need to verify a potentially non-existant host name.

            rdyas Robert Dyas added a comment - Great! Just tried it, and working as expected. Thank you. New Issue: I'll make a seperate thread if its an issue and not a misunderstanding: when i switched from 1.6.3 to 2.2.1 I get the error: SSL hostname verification failed : IPv4 host "35.224.113.70" doesn't correspond to certificate CN "si-mariadb-shared1-v1.parasql.com" My connect string includes the following and was connecting to a specific IP address: &useSSL=true&trustServerCertificate=false&serverSslCert= etc That setting under 2.2.1 throws an exception and the documentation states the following: disableSslHostnameVerification When using ssl, the driver checks the hostname against the server's identity as presented in the server's certificate (checking alternative names or the certificate CN) to prevent man-in-the-middle attacks. This option permits deactivating this validation. Hostname verification is disabled when the trustServerCertificate option is set Default: false. Since 2.1.0 It is unclear to me if set means set to true or false. It would seem that since I am connecting to an IP and verifying the CA that I don't need to verify a potentially non-existant host name.
            diego dupin Diego Dupin added a comment -

            That's a because driver ensures hostname verification.
            SSL certificate must have a SAN (Subject Alternative Name) that corresponds to the current host used for connection (RFC 6125)
            Or if no SAN are present (not recommended for more than 10 years), Driver use CN name to check hostname (RFC 2818).

            If 35.224.113.70 correspond to si-mariadb-shared1-v1.parasql.com, just use this DNS name to connect. If not, the best solution would be to create an SSL certificate with correct SAN values.

            This validation can be avoided setting option "disableSslHostnameVerification" to true.

            diego dupin Diego Dupin added a comment - That's a because driver ensures hostname verification. SSL certificate must have a SAN (Subject Alternative Name) that corresponds to the current host used for connection (RFC 6125) Or if no SAN are present (not recommended for more than 10 years), Driver use CN name to check hostname (RFC 2818). If 35.224.113.70 correspond to si-mariadb-shared1-v1.parasql.com, just use this DNS name to connect. If not, the best solution would be to create an SSL certificate with correct SAN values. This validation can be avoided setting option "disableSslHostnameVerification" to true.

            People

              diego dupin Diego Dupin
              rdyas Robert Dyas
              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.