1
votes

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!

3
@a_horse_with_no_name using single backslash is not really an option: this is a java string after all.Mark Rotteveel

3 Answers

1
votes

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!

0
votes

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?

0
votes

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: