guowdxp opened a new issue #1910: blob column insert exception: Unknown 
exception: INSERT INTO column size mismatch value size
URL: https://github.com/apache/incubator-shardingsphere/issues/1910
 
 
   ## Bug Report
   
   
   ### Which version of ShardingSphere did you use?
   4.0.0.M1
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   sharding-proxy
   ### Expected behavior
   images table has no shards.
   
   The images table structure is as follows:
   
        CREATE TABLE `images` (
          `id` int(11) DEFAULT NULL,
          `image` blob
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
   
   java code is as follows:
   
       @Test
       public void blobInsertTest() throws Exception {
   
           Class.forName("com.mysql.jdbc.Driver");
   
           String sql = "INSERT INTO images(id,image) values(?,?)";
           Connection conn = DriverManager.getConnection(url, username, 
password);
           PreparedStatement ps = conn.prepareStatement(sql);
   
           ps.setInt(1,2);
           InputStream in = new FileInputStream("f:\\1122.jpg");
           ps.setBlob(2, in);
           int count = ps.executeUpdate();
           System.out.println(count);
   
       }
   
   Run the code normally by connecting mysql.
   
   Running code by connecting sharding-proxy  reports the error as follows:
   
        java.sql.SQLException: Unknown exception: INSERT INTO column size 
mismatch value size.
                at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)
                at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835)
                at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771)
                at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
                at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
                at 
com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2535)
                at 
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1911)
                at 
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2145)
                at 
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2081)
                at 
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2066)
                at 
com.zhongan.dmds.sharding_sphere.ShardingProxyTest.blobInsertTest(ShardingProxyTest.java:105)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
                at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
                at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
                at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
                at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
                at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
                at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
                at 
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
                at 
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
                at 
org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
                at 
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
                at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
                at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
                at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
          
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to