1

So I have been tasked with pulling data from an old FoxPro .dbf file with java. So far no real joy in the google searches and searches on here. There are several solutions but none seem to be working. I get no error when I run this, it just starts up the jframe, prints out the Class.forName for whatever reason and just sits there. Any thoughts would be appreciated..

try
                {
                   String url = "jdbc:odbc:DRIVER={Microsoft dBase Driver (*.dbf)};DBQ='C:\\Users\\jemmett\\Desktop\\cell\\cell\\BMPNF1.DBF'";
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   Connection connection = DriverManager.getConnection(url);
                   System.out.println("Connect to " + connection.getCatalog() + " a success!");
                }
                catch (ClassNotFoundException | SQLException e)
                {
                    System.out.println(e.getMessage());
                }
  • What did you observe when walking through this code with a debugger? – Kon Jul 18 '17 at 19:04
  • Nothing really, it seems to stop after Class.forName. I even stuck in some System.out.println() in a couple of places to see if it even got there. – Jonathan E. Emmett Jul 18 '17 at 19:06
  • Try catching a `Throwable`, which is the parent class of all exceptions, It may give you a better hint as to what's happening. My guess is your class path does not contain the JDBC library correctly. – Kon Jul 18 '17 at 19:08
  • That was my first guess too, but from what I have read is if this is a current install, which it is, then you don't need to add it. But I will try that thank you. – Jonathan E. Emmett Jul 18 '17 at 19:09
  • Ok @Kon is there a specific driver for a foxpro db? I'm not really getting anywhere. – Jonathan E. Emmett Jul 18 '17 at 19:31
  • By Googling I found http://www.dbschema.com/foxpro-jdbc-driver.html I would suggest pulling the driver from there and using it to connect to your DB. There's a lot of documentation out there about how to use JDBC drivers programatically, but it may vary slightly based on the driver itself. – Kon Jul 18 '17 at 19:43
  • Yeah I saw that one, but I was looking for a free version. I'll keep plugging at it. I'm missing something. No errors still yet. – Jonathan E. Emmett Jul 18 '17 at 19:53
  • Try StelsDBF http://freecode.com/projects/stelsdbf – Alan B Jul 19 '17 at 08:20
  • Also the HXTT JFBC driver which isn't free. http://www.hxtt.com/dbf.html – Alan B Jul 19 '17 at 08:21

0 Answers0