Problems with Java drivers for 64-bit JDBC-ODBC

I have a program that, when compiling using a 32-bit JVM, works fine, but has problems if I try to use a 64-bit JVM. The message I get: "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".

I am trying to connect to Excel and SQL Server databases using the following code:

String file = directory + "/fileName.xlsm";

String connectStr= "jdbc:odbc:DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ="  + file +  ";READONLY=false";

try {
    Class.forName(getDriver());
    gConnection = DriverManager.getConnection(connectStr);
    //do stuff with connection
}

When I tried to check the Driver Manager, it did not have a 64-bit version of the drivers. Any way to fix this is easy and be able to connect using 64-bit drivers without manually changing the settings on the computer (since this program will be distributed on several computers, and I don’t want to download the driver separately forever, the computer that wants to run it) ? Also, is it possible to connect more efficiently using 64-bit drivers or 32-bit drivers as good / fast (I have very large datasets, so small differences can make a difference)?

+5
source share
1 answer

64- 32- ODBC, , . , ODBC , 32- (C:\Windows\SysWow64\odbcad32.exe) 64- (C:\Windows\System32\odbcad32.exe) ODBC ( "" ) - 64- , . .

, , : ODBC Access/Excel 32-, 64- Excel Access. Apache POI library, Java, Excel Office. , , .

Office 2010 . , 64- ODBC Office 2010 , ... ODBC Java-.

+1

All Articles