shardingsphere: shardingjdbc5.0+springboot+oracle:start occured a error 'table or view does not exist',username is dirrerent with table schema
Version information
springBoot:2.1.4.RELEASE shardingSphere:5.0.0-alpha database: oracle
Which project did you use? Sharding-JDBC or Sharding-Proxy?
Sharding-JDBC
config
props:
sql-show: true
dataSources:
ds0: !!com.zaxxer.hikari.HikariDataSource
driverClassName: oracle.jdbc.driver.OracleDriver
jdbcUrl: jdbc:oracle:thin:@//******/message
username: MSG_CONNECT
password: *******
ds1: !!com.zaxxer.hikari.HikariDataSource
driverClassName: oracle.jdbc.driver.OracleDriver
jdbcUrl: jdbc:oracle:thin:@//******/message
username: MSG_CONNECT
password: ******
rules:
- !SHARDING
tables:
END_ADDR:
actualDataNodes: ds$->{0..1}.END_ADDR1
databaseStrategy:
standard:
shardingColumn: CHNL_TYPE
shardingAlgorithmName: database-inline
MESSAGE:
actualDataNodes: ds$->{0..1}.MESSAGE1
databaseStrategy:
standard:
shardingColumn: CHNL_TYPE
shardingAlgorithmName: database-inline
shardingAlgorithms:
database-inline:
type: SHARDING_MESSAGE
props:
algorithm-class-name: com.cmb.sharding.shardAlgorithm.CustomerShardingAlgorithm
Description
my oracle username is MSG_CONNECT,oracle table is in schema MSG.i known shardingjdbc cannot surppot schema,so i set synonyms in oracle.But when i start up my application that i got the error ‘table or views does not exist’.i review the code and found the follow code in class ShardingMetaDataLoader.load()
boolean isCheckingMetaData = props.getValue(ConfigurationPropertyKey.CHECK_TABLE_METADATA_ENABLED);
int maxConnectionsSizePerQuery = props.getValue(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY);
TableRule tableRule = rule.getTableRule(tableName);
if (!isCheckingMetaData) {
DataNode dataNode = dataNodes.getDataNodes(tableName).iterator().next();
return PhysicalTableMetaDataLoader.load(dataSourceMap.get(dataNode.getDataSourceName()), dataNode.getTableName(), databaseType);
}
it according isCheckingMetaData to check PhysicalTableMetaData. i think it check PhysicalTableMetaData from default schema ‘MSG_CONNECT’,but my table is in schema ‘MSG’,so it throw a error ‘table or views does not exist’. And then i add the setting ‘check-table-metadata-enabled=true’,it does not check PhysicalTableMetaData any more.but the next method parallelLoadTables() will invoke same method of PhysicalTableMetaDataLoader.load() method,but it is according to future.So at last i will get the same error ‘table or views does not exist’ or somethimes time out.
How can i deal with it? i’m trying to set hikari param schema=msg,connectionInitSql=alter session set current_schema=msg,but it doesn’t work. If shardingjdbc don’t check table exist when i start my application, i think i will run it because i set the synonyms in oracle.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 3
- Comments: 17 (8 by maintainers)
Hello , this issue has not received a reply for several days. This issue is supposed to be closed.