I'm embedding a JRE in an existing C application using the invocation API, and I'd like to be able to use JDBC to work with the database in that code. This application is a transaction processing application, and the database transaction is managed by code in the C portion of the application, and the java code must run within that transaction. This means that I can't open a new connection, I must re-use the existing one.
So, is there a way to provide JDBC access to an existing ODBC connection handle when setting up the JRE? Some JDBC-ODBC bridge, perhaps, but unlike the existing driver by that name, one that can be set up to use an existing connection and transaction.
My other options, as I see them, are as follows:
Provide java equivalents for every C operation that is possible in the application (this is not desirable for a great many reasons -- we have a great many methods and duplicating them is a pain in the ass.
Write my own JDBC driver that wraps the ODBC connection with JNI. Sure, it'd be a fun weekend (month) project, but I expect to need something done faster than that.
Help me, Stack-Overflow, you're my only hope!