happy89lgk opened a new issue #3016: JdbcTemplate  DDL isn't working 
URL: https://github.com/apache/incubator-shardingsphere/issues/3016
 
 
   ## 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-RC2     but 4.0.0-RC1 is well
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   Sharding-JDBC 
   ### Expected behavior
   JdbcTemplate  DDL  execute successfully
   ### Actual behavior
   JdbcTemplate  DDL  execute failed
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   2019-09-11 09:31:05 [http-nio-8080-exec-1] INFO  ShardingSphere-SQL - Logic 
SQL: show tables like '2019_sys_login_log'
   2019-09-11 09:31:05 [http-nio-8080-exec-1] INFO  ShardingSphere-SQL - 
SQLStatement: 
TransparentOptimizedStatement(tables=Tables(tables=[Table(name=2019_sys_login_log,
 alias=Optional.absent())], schema=Optional.absent()))
   2019-09-11 09:31:05 [http-nio-8080-exec-1] ERROR 
net.hj.base.controller.GlobalExceptionHandler - 出错
   java.lang.IllegalArgumentException: null
        at 
com.google.common.base.Preconditions.checkArgument(Preconditions.java:111)
        at 
org.apache.shardingsphere.shardingjdbc.jdbc.adapter.AbstractResultSetAdapter.<init>(AbstractResultSetAdapter.java:66)
        at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.resultset.ShardingResultSet.<init>(ShardingResultSet.java:51)
        at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingStatement.getCurrentResultSet(ShardingStatement.java:132)
        at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingStatement.getResultSet(ShardingStatement.java:128)
        at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingStatement.executeQuery(ShardingStatement.java:95)
        at 
org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:439)
        at 
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:376)
        at 
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:452)
        at 
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:462)
        at 
org.springframework.jdbc.core.JdbcTemplate.queryForList(JdbcTemplate.java:485)
        at 
net.hj.base.service.sys.impl.LoginLogServiceImpl.checkTable(LoginLogServiceImpl.java:80)
        at 
net.hj.base.service.sys.impl.LoginLogServiceImpl.doLogin(LoginLogServiceImpl.java:54)
   
   
   @Autowired
       private JdbcTemplate jdbcTemplate;
   
    private void checkTable(String year) {
           String sql = "show tables like '"+year+"_sys_login_log'";
           List<String> tables = jdbcTemplate.queryForList(sql, String.class);
           if (tables.size() <= 0) {//没有表.建表
               createTable(year);
           }
       }
   
   ### 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:
[email protected]


With regards,
Apache Git Services

Reply via email to