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/04/29 11:31:56 UTC
[GitHub] [shardingsphere] lvye351 opened a new issue #5383: official example in oracle get meta info go wrong
lvye351 opened a new issue #5383:
URL: https://github.com/apache/shardingsphere/issues/5383
## 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 **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.1.1-SNAPSHOT,5.0.0-RC1-SNAPSHOT ; 4.0.0 and before is ok!
### Which project did you use? Sharding-JDBC or Sharding-Proxy?
Sharding-JDBC
### Expected behavior
demo in oracle is ok as in mysql
### Actual behavior
add ojdbc in pom.xml
`<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1.0</version>`
then execute YamlConfigurationExampleMain
--main-- [ShardingSphere-metadata] Loading 2 logic tables' meta data.
Exception in thread "main" java.sql.SQLSyntaxErrorException: ORA-00942: 表或视图不存在
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1017)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:655)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:566)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:202)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:45)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:933)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1075)
at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1640)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1603)
at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:308)
at oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(OracleDatabaseMetaData.java:4794)
at org.apache.shardingsphere.sql.parser.binder.metadata.index.IndexMetaDataLoader.load(IndexMetaDataLoader.java:48)
at org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataLoader.load(TableMetaDataLoader.java:46)
at org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.load(ShardingMetaDataLoader.java:83)
at org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.loadShardingSchemaMetaData(ShardingMetaDataLoader.java:134)
at org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.load(ShardingMetaDataLoader.java:125)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.ShardingRuntimeContext.loadSchemaMetaData(ShardingRuntimeContext.java:65)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.MultipleDataSourcesRuntimeContext.createMetaData(MultipleDataSourcesRuntimeContext.java:57)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.MultipleDataSourcesRuntimeContext.<init>(MultipleDataSourcesRuntimeContext.java:51)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.ShardingRuntimeContext.<init>(ShardingRuntimeContext.java:49)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.ShardingDataSource.<init>(ShardingDataSource.java:54)
at org.apache.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory.createDataSource(ShardingDataSourceFactory.java:48)
at org.apache.shardingsphere.shardingjdbc.api.yaml.YamlShardingDataSourceFactory.createDataSource(YamlShardingDataSourceFactory.java:50)
at org.apache.shardingsphere.example.sharding.raw.jdbc.factory.YamlDataSourceFactory.newInstance(YamlDataSourceFactory.java:34)
at org.apache.shardingsphere.example.sharding.raw.jdbc.YamlConfigurationExampleMain.main(YamlConfigurationExampleMain.java:42)
if use :
` <dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.1.0</version>
</dependency>`
then:
--main-- [ShardingSphere-metadata] Loading 2 logic tables' meta data.
Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.getSchema()Ljava/lang/String;
at com.zaxxer.hikari.pool.HikariProxyConnection.getSchema(HikariProxyConnection.java)
at org.apache.shardingsphere.sql.parser.binder.metadata.util.JdbcUtil.getSchema(JdbcUtil.java:37)
at org.apache.shardingsphere.sql.parser.binder.metadata.column.ColumnMetaDataLoader.isTableExist(ColumnMetaDataLoader.java:108)
at org.apache.shardingsphere.sql.parser.binder.metadata.column.ColumnMetaDataLoader.load(ColumnMetaDataLoader.java:56)
at org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataLoader.load(TableMetaDataLoader.java:46)
at org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.load(ShardingMetaDataLoader.java:83)
at org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.loadShardingSchemaMetaData(ShardingMetaDataLoader.java:134)
at org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.load(ShardingMetaDataLoader.java:125)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.ShardingRuntimeContext.loadSchemaMetaData(ShardingRuntimeContext.java:65)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.MultipleDataSourcesRuntimeContext.createMetaData(MultipleDataSourcesRuntimeContext.java:57)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.MultipleDataSourcesRuntimeContext.<init>(MultipleDataSourcesRuntimeContext.java:51)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.ShardingRuntimeContext.<init>(ShardingRuntimeContext.java:49)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.ShardingDataSource.<init>(ShardingDataSource.java:54)
at org.apache.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory.createDataSource(ShardingDataSourceFactory.java:48)
at org.apache.shardingsphere.shardingjdbc.api.yaml.YamlShardingDataSourceFactory.createDataSource(YamlShardingDataSourceFactory.java:50)
at org.apache.shardingsphere.example.sharding.raw.jdbc.factory.YamlDataSourceFactory.newInstance(YamlDataSourceFactory.java:34)
at org.apache.shardingsphere.example.sharding.raw.jdbc.YamlConfigurationExampleMain.main(YamlConfigurationExampleMain.java:42)
### Reason analyze (If you can)
get meta is wrong
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
set oracle url in examples\sharding-jdbc-example\sharding-example\sharding-raw-jdbc-example\src\main\resources\META-INF\sharding-databases.yaml
----------
changes:
ds_0: !!com.zaxxer.hikari.HikariDataSource
driverClassName: oracle.jdbc.driver.OracleDriver
jdbcUrl: jdbc:oracle:thin:@ip:1521:cc
username: test
password: test
ds_1: !!com.zaxxer.hikari.HikariDataSource
driverClassName: oracle.jdbc.driver.OracleDriver
jdbcUrl: jdbc:oracle:thin:@ip:1521:cc
username: test2
password: test2
other part is the same as mysql!
it is does not mater with version of hikari-cp.version 3.4.2 or 2.4.11 result is the same
### Example codes for reproduce this issue (such as a github link).
in this project
\examples\sharding-jdbc-example\sharding-example\sharding-raw-jdbc-example\src\main\java\org\apache\shardingsphere\example\sharding\raw\jdbc\YamlConfigurationExampleMain
or
in https://github.com/apache/shardingsphere-example
/sharding-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/sharding/raw/jdbc/YamlConfigurationExampleMain.java
result is the same . mysql is ok
----------------------------------------------------------------
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] cherrylzhao commented on issue #5383: official example in oracle get meta info go wrong
Posted by GitBox <gi...@apache.org>.
cherrylzhao commented on issue #5383:
URL: https://github.com/apache/shardingsphere/issues/5383#issuecomment-621544125
have you test it in newest master branch code?
----------------------------------------------------------------
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] lvye351 commented on issue #5383: official example in oracle get meta info go wrong
Posted by GitBox <gi...@apache.org>.
lvye351 commented on issue #5383:
URL: https://github.com/apache/shardingsphere/issues/5383#issuecomment-621531972
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1.0</version>
</dependency>
result is the same as ojdbc7 !
----------------------------------------------------------------
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] TaoZhiMLND commented on issue #5383: official example in oracle get meta info go wrong
Posted by GitBox <gi...@apache.org>.
TaoZhiMLND commented on issue #5383:
URL: https://github.com/apache/shardingsphere/issues/5383#issuecomment-623519244
@lvye351 hi, has the difficulty been solved for starting this issue? If so, let's close this issue. I have started a new issue to verify the reason why keyGenerator doesn't work when a oracle database used. It's better to discuss one issue at a time, thus let's move attention to issue #5421.
----------------------------------------------------------------
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] cherrylzhao commented on issue #5383: official example in oracle get meta info go wrong
Posted by GitBox <gi...@apache.org>.
cherrylzhao commented on issue #5383:
URL: https://github.com/apache/shardingsphere/issues/5383#issuecomment-623436546
yes, you can comment out `TransactionTypeHolder.set(TransactionType.XA)` or select other examples to verify it.
----------------------------------------------------------------
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] lvye351 commented on issue #5383: official example in oracle get meta info go wrong
Posted by GitBox <gi...@apache.org>.
lvye351 commented on issue #5383:
URL: https://github.com/apache/shardingsphere/issues/5383#issuecomment-622230485
> have you test it in newest master branch code?
yes,but it remains some wrong,i am confirming
----------------------------------------------------------------
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] TaoZhiMLND commented on issue #5383: official example in oracle get meta info go wrong
Posted by GitBox <gi...@apache.org>.
TaoZhiMLND commented on issue #5383:
URL: https://github.com/apache/shardingsphere/issues/5383#issuecomment-622295865
@lvye351 Hi, YamlDataSourceFactory#newInstance execute successfully when I use oracle database 12c, ojdbc8.jar and the newest code of ShardingSphere on the master branch. Method isTableExist have been moved to class TableMetaDataLoader after #5309 , instead of class ColumnMetaDataLoader which in your second Exception log.
The my configuration is as follows,
`sharding-databases.yaml`
```
dataSources:
ds_0: !!com.zaxxer.hikari.HikariDataSource
driverClassName: oracle.jdbc.driver.OracleDriver
jdbcUrl: jdbc:oracle:thin:@localhost:1521:orcl
username: C##DEMO_DS_0
password: DEMO_DS_0
ds_1: !!com.zaxxer.hikari.HikariDataSource
driverClassName: oracle.jdbc.driver.OracleDriver
jdbcUrl: jdbc:oracle:thin:@localhost:1521:orcl
username: C##DEMO_DS_1
password: DEMO_DS_1
```
`pom.xml`
```
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3</version>
</dependency>
```
and the result
![image](https://user-images.githubusercontent.com/9602831/80791156-51792980-8bc3-11ea-8bc6-d0beff0b7ec5.png)
BTW, if you want to run the rest of the code, the SQL statement needs to be modified to fit the Oracle syntax.
----------------------------------------------------------------
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] TaoZhiMLND edited a comment on issue #5383: official example in oracle get meta info go wrong
Posted by GitBox <gi...@apache.org>.
TaoZhiMLND edited a comment on issue #5383:
URL: https://github.com/apache/shardingsphere/issues/5383#issuecomment-622295865
@lvye351 Hi, YamlDataSourceFactory#newInstance execute successfully when I use oracle database 12c, ojdbc8.jar and the newest code of ShardingSphere on the master branch. Method isTableExist have been moved to class TableMetaDataLoader after #5309 , instead of class ColumnMetaDataLoader which in your second Exception log.
My configuration is as follows,
`sharding-databases.yaml`
```
dataSources:
ds_0: !!com.zaxxer.hikari.HikariDataSource
driverClassName: oracle.jdbc.driver.OracleDriver
jdbcUrl: jdbc:oracle:thin:@localhost:1521:orcl
username: C##DEMO_DS_0
password: DEMO_DS_0
ds_1: !!com.zaxxer.hikari.HikariDataSource
driverClassName: oracle.jdbc.driver.OracleDriver
jdbcUrl: jdbc:oracle:thin:@localhost:1521:orcl
username: C##DEMO_DS_1
password: DEMO_DS_1
```
`pom.xml`
```
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3</version>
</dependency>
```
and the result
![image](https://user-images.githubusercontent.com/9602831/80791156-51792980-8bc3-11ea-8bc6-d0beff0b7ec5.png)
BTW, if you want to run the rest of the code, the SQL statement needs to be modified to fit the Oracle syntax.
----------------------------------------------------------------
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] lvye351 commented on issue #5383: official example in oracle get meta info go wrong
Posted by GitBox <gi...@apache.org>.
lvye351 commented on issue #5383:
URL: https://github.com/apache/shardingsphere/issues/5383#issuecomment-623426611
keyGenerator looks does not work, not generated , but ok in mysql
oracle ddl:
CREATE TABLE t_order (order_id number(20) , user_id number NOT NULL, status VARCHAR(50))
or CREATE TABLE t_order (order_id number(20) primary key , user_id number NOT NULL, status VARCHAR(50))
debug :
TableMetaDataLoader
isTableExist false
SELECT NULL AS table_cat,
o.owner AS table_schem,
o.object_name AS table_name,
o.object_type AS table_type,
NULL AS remarks
FROM all_objects o
WHERE o.owner LIKE :1 ESCAPE '/'
AND o.object_name LIKE :2 ESCAPE '/'
AND o.object_type IN ('TABLE', 'SYNONYM', 'VIEW')
ORDER BY table_type, table_schem, table_name
`<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
`
for simple, can use transaction-2pc-xa-raw-jdbc-example show , without XA
----------------------------------------------------------------
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] cherrylzhao commented on issue #5383: official example in oracle get meta info go wrong
Posted by GitBox <gi...@apache.org>.
cherrylzhao commented on issue #5383:
URL: https://github.com/apache/shardingsphere/issues/5383#issuecomment-621280618
it should be fixed in this issue #5309, please confirm it again.
----------------------------------------------------------------
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