Hello,

Yes, that was also my analysis and I found source code of an old Oracle jdbc driver there :

https://github.com/caot/ojdbc6-11.2.0.2.0.src/blob/master/src/oracle/jdbc/driver/OracleStatementWrapper.java



public boolean isWrapperFor(Class<?> paramClass)
    throws SQLException
  {
    if (paramClass.isInterface()) return paramClass.isInstance(this);

    SQLException localSQLException = DatabaseError.createSqlException(getConnectionDuringExceptionHandling(), 177);
    localSQLException.fillInStackTrace();
    throw localSQLException;
  }



I doubt that Oracle will change something in his jdbc driver it is why that would be great if someone has some ideas to solve this problem at the Avatica level (maybe adding an interface for AvaticaPreparedStatement, or split methods adding try {} catch {}, ...)


Thanks for your help.


Thierry



Le 14/05/2020 à 23:35, Laurent Goujon a écrit :
I checked
https://docs.oracle.com/javase/7/docs/api/java/sql/Wrapper.html#isWrapperFor(java.lang.Class),
and it mentions interface in multiple places, but it doesn't say explicitly
that it should throw if the provided argument is not an interface. And I
guess Oracle driver chose to enforce this strictly by throwing an exception
instead of returning false?



On Thu, May 14, 2020 at 12:31 PM Julian Hyde <[email protected]> wrote:

That sounds like a bug in Avatica. I was not aware that in
'isWrapperFor(Class<?> iface)', 'iface' had to be an interface, and
had assumed the driver would just return 'false'.

Can you please log it?

A solution would be to create an interface in Avatica for
AvaticaPreparedStatement. (It seems that the 'handle' field is the
only thing that we need from it.)

Julian

On Thu, May 14, 2020 at 8:53 AM Thierry Rolland
<[email protected]> wrote:
Hello all,


I'm trying calcite avatica v1.16.0 which seems to be a very great tool.

I tried with a postgresql database and that works very fine (I used the
provided docker standalone server for my tests)


Now, I'm trying with an oracle database (v19c) and like for postgresql,
I'm using a docker standalone server.

I'm running on an openJDK11 and I have a problem related to the Oracle
jdbc driver (ojdbc10.jar) which throws an SQLException if the input
parameter of the method */isWrapperFor/* is not a java interface :


java.lang.RuntimeException: java.sql.SQLException: Object does not wrap
anything with requested interface
          at
org.apache.calcite.avatica.jdbc.JdbcMeta.propagate(JdbcMeta.java:700)
          at
org.apache.calcite.avatica.jdbc.JdbcMeta.prepare(JdbcMeta.java:726)
          at

org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:195)
          at

org.apache.calcite.avatica.remote.Service$PrepareRequest.accept(Service.java:1215)
          at

org.apache.calcite.avatica.remote.Service$PrepareRequest.accept(Service.java:1186)
          at

org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:94)
          at
org.apache.calcite.avatica.remote.JsonHandler.apply(JsonHandler.java:52)
          at

org.apache.calcite.avatica.server.AvaticaJsonHandler.handle(AvaticaJsonHandler.java:129)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:61)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.server.Server.handle(Server.java:502)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
          at

org.apache.calcite.avatica.standalone.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
          at java.lang.Thread.run(Thread.java:748)
*Caused by: java.sql.SQLException: Object does not wrap anything with
requested interface**
**        at

oracle.jdbc.driver.OracleStatementWrapper.isWrapperFor(OracleStatementWrapper.java:487)**
**        at
org.apache.calcite.avatica.jdbc.JdbcMeta.prepare(JdbcMeta.java:711)*
          ... 22 more



In the corresponding source code of */JdbcMeta.java/*, the input
parameter of the method /*isWrapperFor* /is the abstract
class/*AvaticaPreparedStatement* /(which is not a java interface) /:
/


Meta.StatementTypestatementType= null;
if(statement.isWrapperFor(AvaticaPreparedStatement.class)) {
finalAvaticaPreparedStatementavaticaPreparedStatement;




Does someone have an idea how to solve this problem ?

Thank you in advance.

Thierry








--


------------------------------------------------------------------------


        
                
        
Thierry Rolland
Software Development Director
t. +49 7851 91 96 0 <tel:+49 7851 91 96 37>

        
                
        
DALIM SOFTWARE GmbH
Strassburger Strasse 6
77694 Kehl, Germany
www.dalim.com <http://www.dalim.com/>


------------------------------------------------------------------------

Geschäftsführer: Dr. Carol Werlé (CEO)
Vorsitzender des Aufsichtsrats (Chairman): Jim D. Salmon
Ust-IdNr. (VAT-Nr.): DE 195 290 616
Sitz der Gesellschaft (Location): Kehl, Amtsgericht Freiburg, HRB 371620

Reply via email to