Python Type 4 (drivers)
greg at brondo.com
Tue Feb 18 20:27:45 CET 2003
Rene -- c/s (?)
Dave -- I've considered the same approach of decompiling the Oracle
drivers (I've actually completed that part). The DJ decompiler is quite
impressive and does a nice job of producing readable code. However, If
I took this approach would I be in violation of the DCMA?
Dave Brueck wrote:
> On Tue, 18 Feb 2003, Greg Brondo wrote:
>>Rene Pijlman wrote:
>>>>Has anyone looked at the possibility of creating a Type 4 (java)
>>>>like drivers for python (completely python native code) ?
>>>I assume you're talking about an implementations of the DB-API.
>>>For any database in particular?
>>Yes. But in python native code (no c extensions -- Just like Type 4
>>drivers work in Java). The initial driver would be for MySQL. MY
>>reasoning here is I'd trade some performance for even greater portability.
> I looked into it for awhile for Oracle because I had many Linux boxes that
> needed DB access from Python and I didn't want to install the monstruous
> Oracle client on each box. In the end I just figured out the (much
> smaller) subset of files needed and installed those instead, but I'm still
> interested in the idea.
> Before I got the Oracle client subset install working I also looked into
> these approaches:
> #1 - Using the pure-Java drivers from Jython - I actually used this one
> for about a year and the DB part worked great but it was a nuisance to
> make all my other modules work properly under Jython (lots of network
> stuff so it often didn't work out-of-the-box in Jython).
> #2 - Finding the Java source for the pure-Java drivers and porting them to
> Python. Since the Java drivers are pretty lightweight it wouldn't be a
> huge undertaking to port them to Python.
> #3 - Decompiling the Java classes and then trying option #2. I couldn't
> get them for Oracle of course, although decompiling the Java bytecode
> revealed that it was less than 60k LOC in the semi-gibberish that
> decompilers spit out. As hideous as it sounds, I ported about 20% of the
> files as a proof of concept (in a weird way it was kind of fun). In the
> end I dropped it though because I figured out the "small Oracle install"
> thing, above, and without any source code comments that expressed the
> intent of each bit of code it was really hard to create a good test suite
> for the ported code. I didn't want to live with code that I couldn't have
> much confidence in.
> The pure Java interfaces run over TCP so if you could get the DB vendor to
> publish the protocol they use then that would be a fairly easy task to
> create a Python version. Barring that, the source code to the Java drivers
> would work too.
More information about the Python-list