You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "Pinkman-oss (via GitHub)" <gi...@apache.org> on 2023/08/10 09:05:30 UTC
[GitHub] [shardingsphere] Pinkman-oss opened a new issue, #28019: Why the org.apache.shardingsphere.dialect.exception.syntax.table.NoSuchTableException Error Occurs When Accessing the Actual Table
Pinkman-oss opened a new issue, #28019:
URL: https://github.com/apache/shardingsphere/issues/28019
## Question
**For English only**, other languages will not accept.
Before asking a question, make sure you have:
- Googled your question.
- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
When I run a SQL statement to access the actual table, the following error occurs:
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**.
`### Cause: java.sql.SQLException: Unknown exception: null
; uncategorized SQLException; SQL state [HY000]; error code [30000]; Unknown exception: null; nested exception is java.sql.SQLException: Unknown exception: null
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy31.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:160)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:87)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
at com.sun.proxy.$Proxy45.selectByPrimaryKey(Unknown Source)
at com.xx.xxxxTest.xx(xxxx.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: java.sql.SQLException: Unknown exception: null
at org.apache.shardingsphere.infra.util.exception.external.sql.ShardingSphereSQLException.toSQLException(ShardingSphereSQLException.java:62)
at org.apache.shardingsphere.dialect.SQLExceptionTransformEngine.toSQLException(SQLExceptionTransformEngine.java:62)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:416)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:497)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)
... 40 more
Caused by: org.apache.shardingsphere.dialect.exception.syntax.table.NoSuchTableException
at org.apache.shardingsphere.infra.connection.validator.ShardingSphereMetaDataValidateUtils.validateTableExist(ShardingSphereMetaDataValidateUtils.java:56)
at org.apache.shardingsphere.sharding.route.engine.validator.dml.impl.ShardingSelectStatementValidator.preValidate(ShardingSelectStatementValidator.java:39)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.lambda$createRouteContext0$0(ShardingSQLRouter.java:67)
at java.util.Optional.ifPresent(Optional.java:159)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext0(ShardingSQLRouter.java:67)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:59)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:47)
at org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:69)
at org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:57)
at org.apache.shardingsphere.infra.connection.kernel.KernelProcessor.route(KernelProcessor.java:60)
at org.apache.shardingsphere.infra.connection.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:51)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createExecutionContext(ShardingSpherePreparedStatement.java:545)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:405)
... 57 more
`
why?and how?
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] clay-f commented on issue #28019: Why the org.apache.shardingsphere.dialect.exception.syntax.table.NoSuchTableException Error Occurs When Accessing the Actual Table
Posted by "clay-f (via GitHub)" <gi...@apache.org>.
clay-f commented on issue #28019:
URL: https://github.com/apache/shardingsphere/issues/28019#issuecomment-1673312473
same error here. I'm learn about latest shardingsphere-jdbc and do some test follow tutorial can't get running
uncategorized SQLException; SQL state [HY000]; error code [30000]; Unknown exception: null
read document from [t_order](https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/)
config.yml
mode:
type: Standalone
repository:
type: JDBC
schemaName: SCOTT
dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: oracle.jdbc.OracleDriver
jdbcUrl: jdbc:oracle:thin:@//127.0.0.1:1521/orcl
username: scott
password: 123456
rules:
- !SINGLE
tables:
- "*.*"
defaultDataSource: db_0
- !SHARDING
tables:
t_order:
actualDataNodes: ds_0.t_order_$->{0..1}
tableStrategy:
standard:
shardingColumn: id
shardingAlgorithmName: t_order_inline
bindingTables:
- t_order
defaultDatabaseStrategy:
standard:
shardingColumn: id
shardingAlgorithmName: database_inline
defaultTableStrategy:
none:
shardingAlgorithms:
database_inline:
type: INLINE
props:
algorithm-expression: ds_0->{id % 2}
t_order_inline:
type: INLINE
props:
algorithm-expression: t_order_$->{id % 2}
props:
sql-show: true
application.yml
spring:
datasource:
driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
url: jdbc:shardingsphere:classpath:config.yml
main:
banner-mode: off
mybatis:
type-aliases-package: com.f.sharedingjdbc.domain
mapper-locations: classpath:mapper/*.xml
logging:
level:
com.f.sharedingjdbc.mapper: debug
order table sql xml file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.f.sharedingjdbc.mapper.OrderMapper">
<select id="list" resultType="com.f.sharedingjdbc.domain.TOrder">
SELECT * FROM t_order
</select>
</mapper>
database have three table used for test query
1. t_order
2. t_order_0
3. t_order_1
--
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] clay-f commented on issue #28019: Why the org.apache.shardingsphere.dialect.exception.syntax.table.NoSuchTableException Error Occurs When Accessing the Actual Table
Posted by "clay-f (via GitHub)" <gi...@apache.org>.
clay-f commented on issue #28019:
URL: https://github.com/apache/shardingsphere/issues/28019#issuecomment-1673378293
I'm found problem, oracle needs change table uppercase for me situation😂
--
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] Pinkman-oss commented on issue #28019: Why the org.apache.shardingsphere.dialect.exception.syntax.table.NoSuchTableException Error Occurs When Accessing the Actual Table
Posted by "Pinkman-oss (via GitHub)" <gi...@apache.org>.
Pinkman-oss commented on issue #28019:
URL: https://github.com/apache/shardingsphere/issues/28019#issuecomment-1673128563
> If you want to access actual table, you should use `/* SHARDINGSPHERE_HINT: DATA_SOURCE_NAME=ds_0 */ SELECT * FROM t_order;` to pass sql to some datasource. For more details, you can refer - https://shardingsphere.apache.org/document/current/en/user-manual/common-config/sql-hint/#datasource-pass-through
Thanks for the answer, but it didn't work.
--
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] strongduanmu commented on issue #28019: Why the org.apache.shardingsphere.dialect.exception.syntax.table.NoSuchTableException Error Occurs When Accessing the Actual Table
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #28019:
URL: https://github.com/apache/shardingsphere/issues/28019#issuecomment-1672860456
If you want to access actual table, you should use `/* SHARDINGSPHERE_HINT: DATA_SOURCE_NAME=ds_0 */ SELECT * FROM t_order;` to pass sql to some datasource. For more details, you can refer - https://shardingsphere.apache.org/document/current/en/user-manual/common-config/sql-hint/#datasource-pass-through
--
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
Re: [I] Why the org.apache.shardingsphere.dialect.exception.syntax.table.NoSuchTableException Error Occurs When Accessing the Actual Table [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #28019: Why the org.apache.shardingsphere.dialect.exception.syntax.table.NoSuchTableException Error Occurs When Accessing the Actual Table
URL: https://github.com/apache/shardingsphere/issues/28019
--
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] clay-f commented on issue #28019: Why the org.apache.shardingsphere.dialect.exception.syntax.table.NoSuchTableException Error Occurs When Accessing the Actual Table
Posted by "clay-f (via GitHub)" <gi...@apache.org>.
clay-f commented on issue #28019:
URL: https://github.com/apache/shardingsphere/issues/28019#issuecomment-1673374292
@Pinkman-oss I may found problem. change your table name uppercase, I'm changed fixed that 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] Pinkman-oss commented on issue #28019: Why the org.apache.shardingsphere.dialect.exception.syntax.table.NoSuchTableException Error Occurs When Accessing the Actual Table
Posted by "Pinkman-oss (via GitHub)" <gi...@apache.org>.
Pinkman-oss commented on issue #28019:
URL: https://github.com/apache/shardingsphere/issues/28019#issuecomment-1673133767
`dataSources:
backup:
dataSourceClassName: xxxx
driverClassName: xxx
url: xxxx
username: xxx
password: xx
filters: stat
initialSize: 5 #连接池初始化连接数
minIdle: 3 #连接池最小连接数
maxActive: 60 #连接池最大连接数
maxWait: 60000 #配置获取连接等待超时的时间
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis : 300000
validationQuery: SELECT 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true #打开PSCache,并且指定每个连接上PSCache的大小
maxPoolPreparedStatementPerConnectionSize: 20
removeAbandoned: true
removeAbandonedTimeout: 200
validationQueryTimeout: 200
logAbandoned: true
rules:
- !SINGLE
tables:
- backup.* # 加载该数据源的全部表
defaultDataSource: backup
- !SHARDING
tables: # 数据分片规则配置
t_user: # 逻辑表名称
actualDataNodes : backup.t_user_$->{1..19}
tableStrategy: # 分表策略,同分库策略
hint: # 用于单分片键的hint分片场景
shardingAlgorithmName: hint_rule # 分片算法名称
# 分片算法配置
shardingAlgorithms:
hint_rule: # 分片算法名称
type: HINT_SHARD # 分片算法类型
props:
sql-show: true`
this is my yaml
--
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] github-actions[bot] commented on issue #28019: Why the org.apache.shardingsphere.dialect.exception.syntax.table.NoSuchTableException Error Occurs When Accessing the Actual Table
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #28019:
URL: https://github.com/apache/shardingsphere/issues/28019#issuecomment-1712925200
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
--
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