473,748 Members | 6,037 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2141
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 SimpleXMLRPCSer ver 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**********@v ideotron.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**********@v ideotron.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**********@v ideotron.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**********@v ideotron.ca> wrote in message news:<zt******* **************@ wagner.videotro n.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:\j 2sdk1.4.2_03\jr e\bin\client\jv m.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:\j 2sdk1.4.2_03\jr e\bin\client\jv m.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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4560
by: Michael Chermside | last post by:
Ype writes: > For the namespaces in Jython this 'Python internal thread safety' > is handled by the Java class: > > http://www.jython.org/docs/javadoc/org/python/core/PyStringMap.html > > which has almost all of it public methods Java synchronized: > > http://cvs.sourceforge.net/viewcvs.py/jython/jython/org/python/core/PyStringMap.
6
2109
by: Dave Benjamin | last post by:
Hey good people, I've been doing a lot of simultaneous Jython and CPython programming lately, and just wanted to say, with no intended ill will toward any of the individuals who have been generous enough to make the two languages possible, that, well, they're kinda different. I guess it was inevitable, but with Jython stuck at Python 2.1, it's not really the same language as CPython is today. You still have to type "from __future__...
4
3427
by: angel | last post by:
A java runtime environment includes jvm and java class (for example classes.zip in sun jre). Of course jython need jvm,but does it need java class. Thanx
11
1617
by: Maurice LING | last post by:
Hi, I'm looking for a suitable thesis topic, so I hope that I can gather some advice on this area that I'm thinking of. Jython appears as a relatively successful attempt to bridge Python to Java and I find that the best part is that it can convert Python codes into Java codes. As said in the webpage, it is a python interpreter written in Java. I am wondering if it is worth reversing this, that is, a Java interpreter implemented in...
5
3685
by: Maurice Ling | last post by:
Hi, I have read that this had been asked before but there's no satisfactory replies then. I have a module (pA) written in python, which originally is called by another python module (pB), and passes a python object (pO) to pB. Now I require pA to be called in a java class (jC) and pass pO into jC. As pA uses non-python modules, I am not able to use Jython on this.
3
2298
by: Jim Hargrave | last post by:
I've read that it is possible to compile jython to native code using GCJ. PyLucene uses this approach, they then use SWIG to create a Python wrapper around the natively compiled (java) Lucene. Has this been done before for with jython? Another approach would be to use JPype to call the jython jar directly. My goal is to be able to script Java code using Jython - but with the twist of using Cpython as a glue layer. This would allow...
4
1511
by: Ramza Brown | last post by:
This is an update from Brian Zimmer of the Jython group, new release: "There is a new release of Jython available at Sourceforge: http://sourceforge.net/project/showfiles.php?group_id=12867 This release includes many major changes since the last full release: - new-style classes - Java Collections integration
3
1284
by: Gerard Flanagan | last post by:
Hello all I have a 'logger' module which is essentially just a facade over the 'logging' standard module. Can this be called from jython, and how is this acheived? This is a colleague's question but I have no knowledge of jython or java, and I can't install them at present in order to figure it out. It appears that the CPython logging builtin is not implemented in Jython, is this correct?
2
3929
by: Felipe De Bene | last post by:
Hi There, I'm trying to run an App I wrote in Python 2.5.2 in Jython 2.2.1 and everything works fine except when I try to import the Standard CPython's cookielib. I know this may sound stupid, I could use an advice here on what's wrong. Thanks in advance, Felipe. Output: Jython 2.2.1 on java1.6.0_07 Type "copyright", "credits" or "license" for more information.
0
9544
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8243
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.