Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: jdbc-1.1.2
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Tested on Windows 7
    • Global Rank:
      3183

      Description

      When using preparedStatement, mariadb java client does not parse ' ( ' ) correctly if they are the last chacacter inside a string.

      Simple (non-prepared) Statement and Mysql Connector/J works OK

      The following class reproduces the issue:

      Test.java
      import java.sql.*;
      
      public class MariaDBTest {
      	static Connection con;
      	
      	public static void main(String[] args) throws Exception {
      		Class.forName("org.mariadb.jdbc.Driver");
      		//Class.forName("com.mysql.jdbc.Driver");
      		String dbUrl = "jdbc:mysql://localhost:3306/";
      		con = DriverManager.getConnection(dbUrl, "root", "root");
      		System.out.println("Connected to " + dbUrl);
      		
      		exec("CREATE DATABASE IF NOT EXISTS test");
      		exec("USE test");
      		exec("DROP TABLE IF EXISTS `test1`");
      		exec("CREATE TABLE `test1` (`col1` varchar(50))");
      		exec("INSERT INTO `test1` VALUES ('\\'a')"); //works
      		exec("INSERT INTO `test1` VALUES ('\\'')");  //does not works
      
      		con.close();
      		System.out.println("Exiting with no errors");
      	}
      	
      	static void exec(String sql) throws SQLException {
      		System.out.println("sql: "+sql);
      		// error occurs only with prepared statement 
      		//con.createStatement().executeUpdate(sql);
      		con.prepareStatement(sql).executeUpdate();
      	}
      }
      

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Vladislav Vaintroub
            Reporter:
            Telmo Brugnara
          • Votes:
            0 Vote for this issue
            Watchers:
            1 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 - 20 minutes
              20m