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 2021/12/01 09:20:12 UTC
[GitHub] [shardingsphere] agzou opened a new issue #13884: throws NoSuchTableException when drop table with oracle database
agzou opened a new issue #13884:
URL: https://github.com/apache/shardingsphere/issues/13884
## 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/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 anymore 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?
5.0.0
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
### Expected behavior
drop table success
### Actual behavior
```java
Exception in thread "main" org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException: Table 'record' doesn't exist
```
### Reason analyze (If you can)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
> pom.xml
```xml
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.7.0.0</version>
</dependency>
</dependencies>
```
> java code
```java
public static void main(String[] args) throws SQLException {
OracleDataSource ds = new OracleDataSource();
ds.setURL("jdbc:oracle:thin:@//127.0.0.1:1521/XE");
ds.setPassword("test");
ds.setUser("test");
AlgorithmProvidedShardingRuleConfiguration ruleConfig = new AlgorithmProvidedShardingRuleConfiguration();
ShardingTableRuleConfiguration tableRuleConfig = new ShardingTableRuleConfiguration("record", "ds0.record_${0..10}");
ruleConfig.setTables(ImmutableList.of(tableRuleConfig));
DataSource sd = ShardingSphereDataSourceFactory.createDataSource(ImmutableMap.of("ds0", ds), ImmutableList.of(ruleConfig), new Properties());
try (Connection conn = sd.getConnection(); Statement stmt = conn.createStatement()) {
stmt.execute("DROP TABLE record");
}
}
```
> run result
```
Exception in thread "main" org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException: Table 'record' doesn't exist
at org.apache.shardingsphere.sharding.route.engine.validator.ddl.ShardingDDLStatementValidator.validateTableExist(ShardingDDLStatementValidator.java:63)
at org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingDropTableStatementValidator.preValidate(ShardingDropTableStatementValidator.java:47)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.lambda$createRouteContext$0(ShardingSQLRouter.java:52)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:52)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:44)
at org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:62)
at org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:53)
at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.route(KernelProcessor.java:54)
at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:46)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.createExecutionContext(ShardingSphereStatement.java:362)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.execute0(ShardingSphereStatement.java:323)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.execute(ShardingSphereStatement.java:279)
at Main.main(Main.java:30)
Process finished with exit code 1
```
### 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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] agzou commented on issue #13884: throws NoSuchTableException when drop table with oracle database
Posted by GitBox <gi...@apache.org>.
agzou commented on issue #13884:
URL: https://github.com/apache/shardingsphere/issues/13884#issuecomment-983453148
**Shardingsphere will read table metadata from database
if drop statmet not use "IF EXISTS",**
close issue!!
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] agzou closed issue #13884: throws NoSuchTableException when drop table with oracle database
Posted by GitBox <gi...@apache.org>.
agzou closed issue #13884:
URL: https://github.com/apache/shardingsphere/issues/13884
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org