Coder Social home page Coder Social logo

JDBC unwrapping doesn't work about pyjnius HOT 5 CLOSED

kivy avatar kivy commented on May 28, 2024
JDBC unwrapping doesn't work

from pyjnius.

Comments (5)

tito avatar tito commented on May 28, 2024

Hi,

Ok, i didn't tried the example, but a fast research on the internet show that DriverManager.getConnection(url) return a Connection from java.sql.Connection on which the method prepareOlapStatement doesn't exist. What you need is an OlapConnection.

The difference here is that we guess the type from the signature. DriverManager.getConnection have no indication about the OlapConnection. And since you don't declare the type of the variable... You need to cast.

Try:

connection = DriverManager.getConnection(url)
connection = cast('org.olap4j.OlapConnection', connection)
result = connection.prepareOlapStatement(mdx).executeQuery()

This might work, not tested. Try and report here :)

from pyjnius.

apalala avatar apalala commented on May 28, 2024

I think that the problem is that Jnius handles objects returned from Java as JavaObject instead of registering their class an returning a proper JavaClass descendant instance.

I'm sorry I have so much to say, and so little time to contribute right now.

from pyjnius.

tito avatar tito commented on May 28, 2024

Can you do a "print connection" and give the result ?

from pyjnius.

tito avatar tito commented on May 28, 2024

Try to:

connection = DriverManager.getConnection(url)
print 'before', connection
connection = cast(OlapConnection, connection)
print 'after', connection

from pyjnius.

imd avatar imd commented on May 28, 2024

OK, the Jython worked by a fluke; the equivalent Java wasn't correct.

from pyjnius.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.