问题
i'm trying to connect to *.dbf (dBase III) file on my Java application, running on a Windows Server 2003 system. I'm encountering this error and I cannot really understand the meaning (sources for OdbcJdbc.java seems to be unavailable):
[Microsoft][ODBC dBase driver] '(unknown)' is not a valid path error
This is the code I run on my application:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String database = "jdbc:odbc:DRIVER={Microsoft dBase Driver(*.dbf)};DBQ=D:\\dbNeri\\CARISTAT;";
Connection conn = DriverManager.getConnection(database);
Statement s = conn.createStatement();
String selTable = "SELECT * FROM CARISTAT";
Does it exists a JDBC driver able to connect to dBase files or do I have to import external libraries to do the magic?
Thanks in advance for your help!
回答1:
Ok guys, I finally found the answer to all my problems.
Without any need to configure a ODBC data source, the mistake in that code was I've targeted directly in my connection string the file name I would like to access. (In the code up here, I removed "\CARISTAT").
Thus the application run easily and with no more JDBC driver error!!
Thanks anyway for your support!
回答2:
Are you able to set up a DSN for that database (using ODBC Administrator)? Maybe you just don't have the dBase ODBC drivers installed on that server?
回答3:
Dbase III is a 16-bit product and Windows Server is a 64-bit environment, which is what causes the compatibility issue.
You will have to use dBDOS to use your DOS based dBase to run our dBase applications on 64-bit platforms.
These sites have more information:
- http://pmcgee@dbasellc.com
- http://www.dbase.com
来源:https://stackoverflow.com/questions/13274120/cannot-connect-to-dbf-file-through-jdbc-drivers