You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/12/25 06:51:29 UTC

[GitHub] [incubator-shardingsphere] Simbafa opened a new issue #3801: "useServerPrepStmts=true" doesn't work

Simbafa opened a new issue #3801: "useServerPrepStmts=true" doesn't work
URL: https://github.com/apache/incubator-shardingsphere/issues/3801
 
 
   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/incubator-shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response **more than 7 days** and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   4.0.0-RC1
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   Sharding-Proxy
   ### Expected behavior
   can get datetime/timestamp correctly
   ### Actual behavior
   ![image](https://user-images.githubusercontent.com/37646009/71435819-a1337a00-2725-11ea-8866-d139eb618036.png)
   
    `[DEBUG] 14:33:14.155 [ShardingSphere-Command-0] o.a.s.s.f.m.c.MySQLCommandExecutorFactory - Execute packet type: COM_STMT_PREPARE, value: MySQLComStmtPreparePacket(sql=/*{"Cookie":"cookie"}*/select * from dbrest)
   [ERROR] 14:33:14.159 [ShardingSphere-Command-0] o.a.s.s.f.c.CommandExecutorTask - Exception occur: 
   java.lang.ClassCastException: org.apache.shardingsphere.shardingproxy.backend.schema.TransparentSchema cannot be cast to org.apache.shardingsphere.shardingproxy.backend.schema.ShardingSchema
   `
   
   After fixing the issue, following error occures at client.
   Caused by: java.lang.ArrayIndexOutOfBoundsException: 8	at com.mysql.jdbc.ResultSetRow.getNativeTimestamp(ResultSetRow.java:614)
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   1. configuration:
   schemaName: test
   dataSources:
     ds_0:
       url: jdbc:mysql://192.168.1.46:3306/test
       username: root
       password: test
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
   
   2. JDBC url:
   jdbc:mysql://192.168.1.46:3307/test?user=root&password=root&useServerPrepStmts=true&zeroDateTimeBehavior=convertToNull
   ** useServerPrepStmts=true** should be used.
   3. data 
   CREATE TABLE IF NOT EXISTS `dbrest` (
     `fid` varchar(50) DEFAULT NULL,
     `fint` int(11) DEFAULT NULL,
     `ffloat` float DEFAULT NULL,
     `ftext` text,
     `fdate` date DEFAULT NULL,
     `fdatetime` datetime DEFAULT NULL,
     `ftimestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
     `ftime` time DEFAULT NULL,
     `fblob` varchar(50) DEFAULT NULL
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
   
   INSERT INTO `dbrest` (`fid`, `fint`, `ffloat`, `ftext`, `fdate`, `fdatetime`, `ftimestamp`, `ftime`, `fblob`) VALUES
   	('1', 1, 1, '1', NULL, NULL, '2019-12-25 14:20:43', NULL, NULL);
   
   **If there are no "null" value, it can return correctly.**
   
   ### Example codes for reproduce this issue (such as a github link).
   

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] tuohai666 commented on issue #3801: "useServerPrepStmts=true" doesn't work

Posted by GitBox <gi...@apache.org>.
tuohai666 commented on issue #3801: "useServerPrepStmts=true" doesn't work
URL: https://github.com/apache/incubator-shardingsphere/issues/3801#issuecomment-569012594
 
 
   @Simbafa 
   Can you tell me how did you fix this issue?
   
    `[DEBUG] 14:33:14.155 [ShardingSphere-Command-0] o.a.s.s.f.m.c.MySQLCommandExecutorFactory - Execute packet type: COM_STMT_PREPARE, value: MySQLComStmtPreparePacket(sql=/*{"Cookie":"cookie"}*/select * from dbrest)
   [ERROR] 14:33:14.159 [ShardingSphere-Command-0] o.a.s.s.f.c.CommandExecutorTask - Exception occur: 
   java.lang.ClassCastException: org.apache.shardingsphere.shardingproxy.backend.schema.TransparentSchema cannot be cast to org.apache.shardingsphere.shardingproxy.backend.schema.ShardingSchema
   `
   
   **_After fixing the issue_**, following error occures at client.

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu closed issue #3801: "useServerPrepStmts=true" doesn't work

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #3801: "useServerPrepStmts=true" doesn't work
URL: https://github.com/apache/incubator-shardingsphere/issues/3801
 
 
   

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on issue #3801: "useServerPrepStmts=true" doesn't work

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #3801: "useServerPrepStmts=true" doesn't work
URL: https://github.com/apache/incubator-shardingsphere/issues/3801#issuecomment-568856970
 
 
   Can you try 4.0.0-RC3?

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] tuohai666 edited a comment on issue #3801: "useServerPrepStmts=true" doesn't work

Posted by GitBox <gi...@apache.org>.
tuohai666 edited a comment on issue #3801: "useServerPrepStmts=true" doesn't work
URL: https://github.com/apache/incubator-shardingsphere/issues/3801#issuecomment-569009083
 
 
   @Simbafa Please tell me:
   1. The connector/j version for sharding-proxy.
   2. What is your client and version?
   3. What is the MySQL version?
   4. Can you show me the configuration file completely?
   

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] Simbafa commented on issue #3801: "useServerPrepStmts=true" doesn't work

Posted by GitBox <gi...@apache.org>.
Simbafa commented on issue #3801: "useServerPrepStmts=true" doesn't work
URL: https://github.com/apache/incubator-shardingsphere/issues/3801#issuecomment-569031293
 
 
   @tuohai666 
   1. mysql-connector-java-5.1.42.jar
   2. test application is created using java
   3. mysql 5.7
   4. the configuration is already included, please refer to the previous section.
   
   Our purpose of using this project is not to split one table to multiple databases.
   Our purpose is to limit the data access by applying some where/value limitations.
   So I hard coded to create a TransparentSchema.
   
   Previously I think if there is only one datasource in a configuration, a TransparentSchema will be used. Maybe my idea is wrong. 
   So I'm sorry I can not help.

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] tuohai666 edited a comment on issue #3801: "useServerPrepStmts=true" doesn't work

Posted by GitBox <gi...@apache.org>.
tuohai666 edited a comment on issue #3801: "useServerPrepStmts=true" doesn't work
URL: https://github.com/apache/incubator-shardingsphere/issues/3801#issuecomment-569009083
 
 
   @Simbafa Please tell me:
   1. The connector/j version for sharding-proxy.
   2. What is your client and version?
   3. What is the MySQL version?
   4. Can you show me the configuration file completely?
   
   BTW, you don't need to set ** useServerPrepStmts=true**, because sharding-proxy already set this inside its codes.

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] tuohai666 commented on issue #3801: "useServerPrepStmts=true" doesn't work

Posted by GitBox <gi...@apache.org>.
tuohai666 commented on issue #3801: "useServerPrepStmts=true" doesn't work
URL: https://github.com/apache/incubator-shardingsphere/issues/3801#issuecomment-569032483
 
 
   It's OK. I'll fix this issue soon.

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] Simbafa commented on issue #3801: "useServerPrepStmts=true" doesn't work

Posted by GitBox <gi...@apache.org>.
Simbafa commented on issue #3801: "useServerPrepStmts=true" doesn't work
URL: https://github.com/apache/incubator-shardingsphere/issues/3801#issuecomment-568859552
 
 
   I tried 4.0.0-RC3, following error occur:
   
   `[ERROR] 15:24:31.791 [ShardingSphere-Command-0] o.a.s.s.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: null
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.wrapper.StatementExecutorWrapper.doTransparentRoute(StatementExecutorWrapper.java:113)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.wrapper.StatementExecutorWrapper.route(StatementExecutorWrapper.java:73)
   `

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


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] tuohai666 commented on issue #3801: "useServerPrepStmts=true" doesn't work

Posted by GitBox <gi...@apache.org>.
tuohai666 commented on issue #3801: "useServerPrepStmts=true" doesn't work
URL: https://github.com/apache/incubator-shardingsphere/issues/3801#issuecomment-569009083
 
 
   @Simbafa Please tell me:
   1. The connector/j version for sharding-proxy.
   2. What is your client and version?
   3. What is the MySQL version?
   
   BTW, you don't need to set ** useServerPrepStmts=true**, because sharding-proxy already set this inside its codes.

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


With regards,
Apache Git Services