Yes, you can
- use a 64-bit ODBC driver from a 32-bit JVM
- use a 32-bit ODBC driver from a 64-bit JVM
- simultaneously use a 64-bit ODBC driver and a 32-bit ODBC driver from the same Java application, in either a 32-bit or 64-bit JVM
You just need to use a Type 3 JDBC connection -- a "multi-tier" JDBC-to-ODBC Bridge -- such as the Enterprise Edition JDBC Driver for ODBC Data Sources from my employer, to bridge the "bitness" gap.
A Type 3 JDBC-to-ODBC connection puts a "pure Java" JDBC Driver in the JVM with your Java app, and this communicates via TCP/IP with some C-based ODBC Client components that go in the "native" OS environment with the ODBC driver(s) -- which need not be on the same host as each other, and neither need be on the same host as the JVM.
Type 3 JDBC Driver in 32-bit JVM
-> ... TCP/IP ...
-> 64-bit ODBC Bridge Middleware
-> 64-bit ODBC Driver
or
Type 3 JDBC Driver in 64-bit JVM
-> ... TCP/IP ...
-> 32-bit ODBC Bridge Middleware
-> 32-bit ODBC Driver
You may choose to use a Type 1 "single-tier" JDBC-to-ODBC Bridge such as the Lite Edition JDBC Driver for ODBC Data Sources from my employer that matches the bitness of the JVM and one ODBC driver (let's say 64-bit, here), and use the "multi-tier" JDBC-to-ODBC Bridge only for the other (32-bit) ODBC driver. Remember that Java 8 and later no longer include the Sun JDBC-to-ODBC Bridge (classname sun.jdbc.odbc.JdbcOdbcDriver
, used jdbc:odbc:<dsn>;UID=<uid>;PWD=<pwd>
URLs) in the JVM.