jython 2 cpython bridge

Nicolas Lehuen nicolas at lehuen.com
Thu Jun 3 03:42:21 EDT 2004


Steve Menard <steve.menard at videotron.ca> wrote in message news:<ztHsc.42467$Fk4.1873925 at wagner.videotron.net>...
> Irmen de Jong wrote:
> > Randall Smith wrote:
> > 
> >> I would like to use a type 4 JDBC driver in my Python program.  I 
> >> believe I can use in with Jython.  Do you know of some way to 
> >> communicate between the Jython and Python processes so that the 
> >> CPython program can use the Jython JDBC database connection?
> > 
> > 
> > Create some form of IPC between the two, for instance using xmlrpc.
> > 
> > --Irmen
> > 
> > PS: I would have suggested to use Pyro, but:
> >  - Java/Jython doesn't have the select() system call that Pyro needs for 
> > a server,
> >  - There are bugs in Jython that make it crash when compiling Pyro's 
> > source.
> 
> <shameless plug>
> Alternately, you can look at JPype ( http://jpype.sourceforge.net ).
> 
> It is still a very early release, but I would welcome any feeback. And 
> version 0.1 should allow you to use JDBC without problem.
> 
> It currently only works on Windows, but if there is interest, I could 
> make a linux release pretty quickly.
> 
> </shameless plug>

That's awesome ! This is still a little bit rough on the edges, but it
already works well enough to have an idea of what it could bring to
Python.

This is what I mean by 'rough on the edge' : launching a Python
program using JPype from a .py file is OK, but using the prompt is
weird :

>>> from jpype import *
>>> startJVM(r"C:\j2sdk1.4.2_03\jre\bin\client\jvm.dll", "-ea")
>>> 1+1
  File "<stdin>", line 1
    1+1
       ^
SyntaxError: invalid syntax
>>> help()
  File "<stdin>", line 1
    help()
          ^
SyntaxError: invalid syntax

Anyway, this is extremely promising. Soon, we'll be able to seamlessly
use Java object thanks to JPype, as we do with COM objects using
win32all or ctypes. Python is THE real integration/composition
platform !

Thanks for your work, Steve.

Regards,
Nicolas



More information about the Python-list mailing list