PaleWhiteDot commented on issue #10419:
URL:
https://github.com/apache/shardingsphere/issues/10419#issuecomment-846895863
> > > @PaleWhiteDot @chenxk I have tried to reproduce this problem, but
failed. Can you provide steps to reproduce this exception?
> >
> >
> > I found where the question is? In this
method:PhysicalIndexMetaDataLoader.load(final Connection connection, final
String table), will invoke connection.getSchema() and then will invoke the
instance MetaDataConnectionAdapter.getSchema()
> > ```
> > public String getSchema() {
> > return
DatabaseMetaDataDialectHandlerFactory.findHandler(databaseType).map(handler ->
handler.getSchema(connection)).orElse(getSchema(connection));
> > }
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > handle.getSchema(connection) like this(in this method
OracleDatabaseMetaDataDialectHandler.getSchema())
> > ```
> > @Override
> > public String getSchema(final Connection connection) {
> > try {
> > return
Optional.ofNullable(connection.getMetaData().getUserName()).map(String::toUpperCase).orElse(null);
> > } catch (final SQLException ignored) {
> > return null;
> > }
> > }
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > The code try to get my username as the schema, undoubted it is
impossible be null,so this place
> > ```
> > handler.getSchema(connection)).orElse(getSchema(connection))
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > won't invoke orElse logic.But If invoke orElse i will get the correct
schema
>
> I also solved it like this!
I'm not solved it, I just found where the question is.I don't know how to
solve 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:
[email protected]