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/07 02:11:33 UTC

[GitHub] [shardingsphere] 743834110 commented on a diff in pull request #21980: fix ShardingSphereException:oracle.jdbc.driver.T4CConnection.getSchem…

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