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 2022/11/06 13:17:38 UTC

[GitHub] [shardingsphere] 743834110 opened a new pull request, #21980: fix ShardingSphereException:oracle.jdbc.driver.T4CConnection.getSchem…

743834110 opened a new pull request, #21980:
URL: https://github.com/apache/shardingsphere/pull/21980

   Fixes #14463.
   
   Changes proposed in this pull request:
     - Fix ShardingSphereException:oracle.jdbc.driver.T4CConnection.getSchema() when using ojdbc6;
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [ ] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [ ] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [ ] I have passed maven check locally : `mvn clean install -B -T2C -DskipTests -Dmaven.javadoc.skip=true -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [ ] I have added corresponding unit tests for my changes.
   


-- 
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 a diff in pull request #21980: fix ShardingSphereException:oracle.jdbc.driver.T4CConnection.getSchem…

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #21980:
URL: https://github.com/apache/shardingsphere/pull/21980#discussion_r1014844593


##########
infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/dialect/OracleSchemaMetaDataLoader.java:
##########
@@ -74,7 +75,7 @@ public final class OracleSchemaMetaDataLoader implements DialectSchemaMetaDataLo
     public Collection<SchemaMetaData> load(final DataSource dataSource, final Collection<String> tables, final String defaultSchemaName) throws SQLException {
         Map<String, Collection<ColumnMetaData>> columnMetaDataMap = new HashMap<>(tables.size(), 1);
         Map<String, Collection<IndexMetaData>> indexMetaDataMap = new HashMap<>(tables.size(), 1);
-        try (Connection connection = dataSource.getConnection()) {
+        try (Connection connection = new MetaDataLoaderConnectionAdapter(DatabaseTypeFactory.getInstance("Oracle"), dataSource.getConnection())) {

Review Comment:
   Why add MetaDataLoaderConnectionAdapter?



-- 
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 merged pull request #21980: fix ShardingSphereException:oracle.jdbc.driver.T4CConnection.getSchem…

Posted by GitBox <gi...@apache.org>.
strongduanmu merged PR #21980:
URL: https://github.com/apache/shardingsphere/pull/21980


-- 
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] 743834110 commented on a diff in pull request #21980: fix ShardingSphereException:oracle.jdbc.driver.T4CConnection.getSchem…

Posted by GitBox <gi...@apache.org>.
743834110 commented on code in PR #21980:
URL: https://github.com/apache/shardingsphere/pull/21980#discussion_r1014948973


##########
infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/dialect/OracleSchemaMetaDataLoader.java:
##########
@@ -74,7 +75,7 @@ public final class OracleSchemaMetaDataLoader implements DialectSchemaMetaDataLo
     public Collection<SchemaMetaData> load(final DataSource dataSource, final Collection<String> tables, final String defaultSchemaName) throws SQLException {
         Map<String, Collection<ColumnMetaData>> columnMetaDataMap = new HashMap<>(tables.size(), 1);
         Map<String, Collection<IndexMetaData>> indexMetaDataMap = new HashMap<>(tables.size(), 1);
-        try (Connection connection = dataSource.getConnection()) {
+        try (Connection connection = new MetaDataLoaderConnectionAdapter(DatabaseTypeFactory.getInstance("Oracle"), dataSource.getConnection())) {

Review Comment:
   Using ojdbc6 with defined development circumstance, there will be a NoSuchMethodError like "java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.getSchema()Ljava/lang/String;" when invoke following statement in OracleSchemaMetaDataLoader
   ```
       private Map<String, Collection<ColumnMetaData>> loadColumnMetaDataMap(final Connection connection, final Collection<String> tables) throws SQLException {
           ...
               preparedStatement.setString(1, connection.getSchema());
           ...
       }
   ```
   With debug with connection.getSchema(). We could know ojdbc6 doesn't define method T4CConnection.getSchema().
   To invoke connection.getSchema() smoothly, adapt a class like MetaDataLoaderConnectionAdapter
   
   



-- 
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