JNI and JDBC Connections

borg48
borg48 used Ask the Experts™
on
I've been trying to figure out if a JDBC Connection can be passed via jni?  My C program will call the JNI interface to connect and it will return JDBC Connection back to my C program.  Can this be done?  

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mick BarryJava Developer
Top Expert 2010

Commented:
Can't see why not, but have to ask why?

Commented:
Why? Well, a similar thing is done in the JBoss app server for example. You specify parameters for your database connections in a JBoss config file and JBoss will then make a datasource available to clients via JNI.
This is a good thing because you can then change all your aspects of your database connections (connection pooling, timeouts,...) in a single file without having to make code changes.

Author

Commented:
The reason is b/c I was thinking of playing with python and they dont have any free sql server drivers like free jtds.  So if i can connect to it via jni it would be great.
Java Developer
Top Expert 2010
Commented:
As I said above I can't see why not.
The other option would be to simply call a Java method from your C prog that makes the database call and returns the result in an appropriate format.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial