java ee - How to use the ODBC 64 bit to read the excel file in Windows 7 64 bit machine -


i need read excel file through odbc 64 bit in windows 7 64 bit machine.

by default in system there 2 odbcad32

  1. [32-bit] c:\windows\syswow64\odbcad32 (it contains microsoft excel driver)
  2. [64-bit] c:\windows\system32\odbcad32 (it doesn't have microsoft excel driver)

since, system doesn't have microsoft excel driver in 64 bit odbc, downloaded accessdatabaseengine_x64 , installed it.

after successful installation under

[64-bit] c:\windows\system32\odbcad32 microsoft excel driver present.

now when run java program through eclipse. error message displayed like

no suitable driver found jdbc:odbc:driver={microsoft access driver (*.mdb, *.accdb)};dbq=c:/users/ashokkumarg/desktop/excel/testcasedata.xls

but same code works in windows 32 bit machine. dont know cause.

java version

windows 7 32 bit machine (where code works) 1.7.0_51

windows 7 64 bit machine (where code fails) 1.8.0_31

code

import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement;   public class connectiontest {  public static void main(string[] args) throws sqlexception {  connection c = null; statement stmnt = null;   system.out.println("test case started running"); try{   c = drivermanager.getconnection( "jdbc:odbc:driver={microsoft access driver (*.mdb, *.accdb)};dbq=c:/users/ashokkumarg/desktop/excel/testcasedata.xls");  stmnt = c.createstatement(); string query = "select * [testcase$];"; resultset rs = stmnt.executequery( query );  while( rs.next() ) { system.out.println( rs.getstring( "page" )); } } catch(exception e){ e.printstacktrace(); } } } 

i have few questions on here:

  1. when 2 odbcad32 present, how read excel file using odbc 64 bit in windows 7 64 bit machine.

  2. while running program whether taking 32 bit odbcad32 driver details. if how need configure odbc 64 bit drivers use in program.

if system.getproperty("java.version") returning "1.8.xxxx" machine running java 8 , jdbc-odbc bridge not available because has been removed java 8.

if want application use odbc have make sure users running java 7 or earlier. might difficult if don't directly manage machines because automatic update feature of java runtime (jre) distributes java 8.

if want application able run under java 8 have use other way of accessing excel data. apache poi 1 possibility.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -