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 2020/06/09 16:37:57 UTC

[GitHub] [shardingsphere] ganzr opened a new issue #5960: sql must specify databaseName?

ganzr opened a new issue #5960:
URL: https://github.com/apache/shardingsphere/issues/5960


   sharding-proxy:4.1.0
   mysql:5.7.29
   my java program work well with direct connection with mysql server. By sql throws exception when connectted to sharding-proxy.
   It seems that sql must specify the databaseName, although the connection property in url of datasource has already contained the databaseName. eg. spring.datasource.url=jdbc:mysql://localhost:3307/db1?characterEncoding=UTF-8&serverTimezone=Asia.
   Is there any configuration property can avoid this specification in sql?


----------------------------------------------------------------
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



[GitHub] [shardingsphere] kimmking closed issue #5960: why can't use block as a table name directly in a query?

Posted by GitBox <gi...@apache.org>.
kimmking closed issue #5960:
URL: https://github.com/apache/shardingsphere/issues/5960


   


----------------------------------------------------------------
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



[GitHub] [shardingsphere] ganzr commented on issue #5960: sql must specify databaseName?

Posted by GitBox <gi...@apache.org>.
ganzr commented on issue #5960:
URL: https://github.com/apache/shardingsphere/issues/5960#issuecomment-641086188






----------------------------------------------------------------
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



[GitHub] [shardingsphere] kimmking edited a comment on issue #5960: sql must specify databaseName?

Posted by GitBox <gi...@apache.org>.
kimmking edited a comment on issue #5960:
URL: https://github.com/apache/shardingsphere/issues/5960#issuecomment-641075593


   plz show your exception stack and sql、config rules.


----------------------------------------------------------------
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



[GitHub] [shardingsphere] kimmking edited a comment on issue #5960: sql must specify databaseName?

Posted by GitBox <gi...@apache.org>.
kimmking edited a comment on issue #5960:
URL: https://github.com/apache/shardingsphere/issues/5960#issuecomment-642450001


   block is a keyword for mysql[1]
   
   1. https://dev.mysql.com/doc/refman/5.7/en/keywords.html


----------------------------------------------------------------
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



[GitHub] [shardingsphere] kimmking commented on issue #5960: sql must specify databaseName?

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5960:
URL: https://github.com/apache/shardingsphere/issues/5960#issuecomment-641075593


   plz show your exception stack and sql.


----------------------------------------------------------------
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



[GitHub] [shardingsphere] ganzr edited a comment on issue #5960: sql must specify databaseName?

Posted by GitBox <gi...@apache.org>.
ganzr edited a comment on issue #5960:
URL: https://github.com/apache/shardingsphere/issues/5960#issuecomment-641086188


   **exception thrown by sharding-proxy:**
   [ERROR] 15:02:37.405 [ShardingSphere-Command-8] o.a.s.s.f.c.CommandExecutorTask - Exception occur:
   java.lang.NullPointerException: null
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitEscapedTableReference(MySQLDMLVisitor.java:491)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitEscapedTableReference(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$EscapedTableReferenceContext.accept(MySQLStatementParser.java:5947)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitTableReferences(MySQLDMLVisitor.java:484)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitTableReferences(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$TableReferencesContext.accept(MySQLStatementParser.java:5891)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitFromClause(MySQLDMLVisitor.java:476)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitFromClause(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$FromClauseContext.accept(MySQLStatementParser.java:5846)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelectClause(MySQLDMLVisitor.java:329)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelectClause(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$SelectClauseContext.accept(MySQLStatementParser.java:4551)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitUnionClause(MySQLDMLVisitor.java:317)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitUnionClause(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$UnionClauseContext.accept(MySQLStatementParser.java:4446)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelect(MySQLDMLVisitor.java:309)
           at org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelect(MySQLDMLVisitor.java:127)
           at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$SelectContext.accept(MySQLStatementParser.java:3098)
           at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
           at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse0(SQLParserEngine.java:80)
           at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse(SQLParserEngine.java:61)
           at org.apache.shardingsphere.shardingproxy.backend.text.TextProtocolBackendHandlerFactory.newInstance(TextProtocolBackendHandlerFactory.java:69)
           at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.<init>(MySQLComQueryPacketExecutor.java:65)
           at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.MySQLCommandExecutorFactory.newInstance(MySQLCommandExecutorFactory.java:70)
           at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.MySQLCommandExecuteEngine.getCommandExecutor(MySQLCommandExecuteEngine.java:59)
           at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:92)
           at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
           at java.lang.Thread.run(Unknown Source)
   
   
   **sql: select * from BLOCK;**
   
   
   **confilg rules:**
   
   shardingRule:
    tables:
      BLOCK:
        actualDataNodes: ds_${0..1}.BLOCK
        tableStrategy:
          inline:
            shardingColumn: ID
            algorithmExpression: BLOCK_${ID % 2}
        keyGenerator:
          type: SNOWFLAKE
          column: ID
      STATE:
       actualDataNodes: ds_${0..1}.STATE
       tableStrategy:
         inline:
           shardingColumn: ID
           algorithmExpression: STATE_${ID % 2}
      TRANSACTION:
       actualDataNodes: ds_${0..1}.TRANSACTION
       tableStrategy:
         inline:
           shardingColumn: ID
           algorithmExpression: TRANSACTION_${ID % 2}
    bindingTables:
      - BLOCK,STATE,TRANSACTION
    broadcastTables:
      - BLOCK_CACHE,
    defaultDataSourceName: ds_0
    defaultDatabaseStrategy:
      inline:
        shardingColumn: ID
        algorithmExpression: ds_${ID % 2}
    defaultTableStrategy:
      none:
   
   **server config:**
   ![image](https://user-images.githubusercontent.com/20966436/84117900-cfeba580-aa64-11ea-9ad0-1b11863b53b1.png)
   
   


----------------------------------------------------------------
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



[GitHub] [shardingsphere] kimmking commented on issue #5960: sql must specify databaseName?

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5960:
URL: https://github.com/apache/shardingsphere/issues/5960#issuecomment-642450001


   block is a keyword for mysql


----------------------------------------------------------------
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