469,912 Members | 1,731 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,912 developers. It's quick & easy.

jython 2 cpython bridge

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?

Randall
Jul 18 '05 #1
10 1976
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?

Randall


Write the application using Jython. Then use SimpleXMLRPCServer on the
Jython side to register the necessary functions for an XML-RPC client
written in Python.

HTH
T
Jul 18 '05 #2
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.
Jul 18 '05 #3
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>
Jul 18 '05 #4
Alternately, you can look at JPype ( http://jpype.sourceforge.net ).

Wow. Cool idea :-)

Ciao,
Dominic
Jul 18 '05 #5
Steve Menard <st**********@videotron.ca> writes:
[...]
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.


I assume you've seen JPE?

How does / will JPype differ from that?

I *think* JPE hasn't been maintained for quite a while, but I'm not
certain what its current state is.
John
Jul 18 '05 #6
John J. Lee wrote:
Steve Menard <st**********@videotron.ca> writes:
[...]
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.

I assume you've seen JPE?

How does / will JPype differ from that?

I *think* JPE hasn't been maintained for quite a while, but I'm not
certain what its current state is.
John


Yes I have seen JPE. However, from the my admitedly quick look, it
didn't allow the seemless integration I am looking for. Either that, or
the samples did show off what JPE could do.

Besides I intend to take JPype beyonf Python->Java integration, and
choice is always good :)

Steve
Jul 18 '05 #7
Steve Menard <st**********@videotron.ca> writes:
[...]
Besides I intend to take JPype beyonf Python->Java integration, and
choice is always good :)


Especially when the closest alternative is unmaintained! I've
certainly wanted something like this in the past.

Good luck with your project.
John
Jul 18 '05 #8
Steve Menard <st**********@videotron.ca> wrote in message news:<zt*********************@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
Jul 18 '05 #9
ni*****@lehuen.com (Nicolas Lehuen) wrote in message
<<snip>>

<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


Thanks for your enthusiasm, and for the feedback.

However, I have tried what you've described above, and had no problem.
further An invalid syntax is usually something thrown by the parser,
way before any JPype-related code sees the commands.

If the problem persists, can you enter a bug report at JPype's
souceforge project page? ( http://sourceforge.net/projects/jpype/ )

I would like to use SF's tracking features to keep everyone up to date
on what is going on. As a matter of fact you'll be able to track each
releases progress by looking at the task list.

Again, thanks for your interest.

Steve Ménard
Jul 18 '05 #10
How about Spiro?

http://www.freenet.org.nz/python/spiro/

Randall Smith <ra*****@tnr.cc> wrote in message news:<8dssc.179150$f_5.163363@lakeread01>...
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?

Randall

Jul 18 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Michael Chermside | last post: by
6 posts views Thread by Dave Benjamin | last post: by
4 posts views Thread by angel | last post: by
11 posts views Thread by Maurice LING | last post: by
3 posts views Thread by Jim Hargrave | last post: by
4 posts views Thread by Ramza Brown | last post: by
3 posts views Thread by Gerard Flanagan | last post: by
2 posts views Thread by Felipe De Bene | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.