Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: jdbc-1.1.0
    • Fix Version/s: jdbc-1.1.1
    • Labels:
    • Environment:
    • Global Rank:
      2389

      Description

      We use MySQL as database, and Ant and JDBC to prepare test databases.
      We recently switched over from commercial MySQL driver, to the MariaDB client. Our main application works fine with the MariaDB client, but when using Ant and JDBC to execute database preparation operations, such as; drop, create, use, MariaDB hangs indefinitely.

      We've tried drop, create database, use database, select * from mysql.user, all hangs forever. (One one occasion our build hang approximately 14 hours over night.)

      This target using MariaDB client, hangs:
      <target name="sql-maria">
      <sql userid="root" password="root" url="jdbc:mysql://localhost/" driver="org.mariadb.jdbc.Driver" classpath="mariadb-client-1.0.0.jar" print="true">
      use my_database;
      </sql>
      </target>

      Output from MySQL in mysqld.sql:
      130114 10:11:07 101 Connect root@localhost on
      101 Query select @@sql_mode
      101 Query set autocommit=0
      101 Query use my_database

      This target using MySQL commercial driver, works fine:
      <target name="sql">
      <sql userid="root" password="root" url="jdbc:mysql://localhost/" driver="com.mysql.jdbc.Driver" classpath="mysql-connector-java-commercial-5.1.13-bin.jar" print="true">
      use my_database;
      </sql>
      </target>

      Output from MySQL in mysqld.sql:
      130114 10:10:46 100 Connect root@localhost on
      100 Query /* mysql-connector-java-commercial-5.1.13 ( Revision: $

      {bzr.revision-id} ) */SHOW VARIABLES WHERE Variable_name ='language' OR Variable_name = 'net_write_timeout' OR Variable_name = 'interactive_timeout' OR Variable_name = 'wait_timeout' OR Variable_name = 'character_set_client' OR Variable_name = 'character_set_connection' OR Variable_name = 'character_set' OR Variable_name = 'character_set_server' OR Variable_name = 'tx_isolation' OR Variable_name = 'transaction_isolation' OR Variable_name = 'character_set_results' OR Variable_name = 'timezone' OR Variable_name = 'time_zone' OR Variable_name = 'system_time_zone' OR Variable_name = 'lower_case_table_names' OR Variable_name = 'max_allowed_packet' OR Variable_name = 'net_buffer_length' OR Variable_name = 'sql_mode' OR Variable_name = 'query_cache_type' OR Variable_name = 'query_cache_size' OR Variable_name = 'init_connect'
      100 Query /* mysql-connector-java-commercial-5.1.13 ( Revision: ${bzr.revision-id}

      ) */SELECT @@session.auto_increment_increment
      100 Query SHOW COLLATION
      100 Query SET character_set_results = NULL
      100 Query SET autocommit=1
      100 Query SET sql_mode='STRICT_TRANS_TABLES'
      100 Query SET autocommit=0
      100 Query use my_database
      100 Query SHOW WARNINGS
      100 Query commit
      100 Query rollback
      100 Quit

      1. build.xml
        0.8 kB
        Elena Stepanova

        Activity

        Hide
        Elena Stepanova added a comment - - edited

        Reproducible on CentOS 5.8 with mysql-5.1.56 and ant 1.8.4.

        Show
        Elena Stepanova added a comment - - edited Reproducible on CentOS 5.8 with mysql-5.1.56 and ant 1.8.4.
        Hide
        Elena Stepanova added a comment -

        Here is the difference that makes ant with MariaDB driver fall into an endless loop:

        public class MyClass
        {
        public static void main (String argv[])
        {
        ResultSet rs;
        Boolean ret;
        int updCount = 0, updCountTotal = 0;
        try

        { Statement st = DriverManager.getConnection("jdbc:mysql://localhost:3306/","root","").createStatement(); st.execute("use test"); updCount = st.getUpdateCount(); System.out.println("Updated rows (1st get): " + updCount); st.getMoreResults(); updCount = st.getUpdateCount(); System.out.println("Updated rows (2nd get): " + updCount); }

        catch (Exception e)

        { System.out.println("Exception: " + e + "\n"); }

        }
        }

        Output with MySQL connector:

        Updated rows (1st get): 0
        Updated rows (2nd get): -1

        Output with MariaDB driver:

        Updated rows (1st get): 0
        Updated rows (2nd get): 0

        Ant does this getMoreResults / getUpdateCount dance in a loop until it encounters -1, which in case of MariaDB driver never happens.

        Show
        Elena Stepanova added a comment - Here is the difference that makes ant with MariaDB driver fall into an endless loop: public class MyClass { public static void main (String argv[]) { ResultSet rs; Boolean ret; int updCount = 0, updCountTotal = 0; try { Statement st = DriverManager.getConnection("jdbc:mysql://localhost:3306/","root","").createStatement(); st.execute("use test"); updCount = st.getUpdateCount(); System.out.println("Updated rows (1st get): " + updCount); st.getMoreResults(); updCount = st.getUpdateCount(); System.out.println("Updated rows (2nd get): " + updCount); } catch (Exception e) { System.out.println("Exception: " + e + "\n"); } } } Output with MySQL connector: Updated rows (1st get): 0 Updated rows (2nd get): -1 Output with MariaDB driver: Updated rows (1st get): 0 Updated rows (2nd get): 0 Ant does this getMoreResults / getUpdateCount dance in a loop until it encounters -1, which in case of MariaDB driver never happens.
        Hide
        Elena Stepanova added a comment -

        Attached build.xml used to test with ant. It has 3 targets:
        sql-mysql - uses MySQL Connector/J
        sql-maria-broken - uses MariaDB driver 1.0.0
        sql-maria-fixed - uses the fixed driver (rename to whichever it is for you)

        Show
        Elena Stepanova added a comment - Attached build.xml used to test with ant. It has 3 targets: sql-mysql - uses MySQL Connector/J sql-maria-broken - uses MariaDB driver 1.0.0 sql-maria-fixed - uses the fixed driver (rename to whichever it is for you)

          People

          • Assignee:
            Vladislav Vaintroub
            Reporter:
            Fredrik Vihlborg
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 5 hours
              5h