File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes ODBC and xBase Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "ODBC and xBase" Watch "ODBC and xBase" New topic

ODBC and xBase

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Our company is in the process of migrating from Clipper applications to Java (2.0) and, ultimately, Oracle. In the meantime, it is necessary to write Java applications that will talk to xBase tables. Windows (95-8) and NT provide an ODBC driver for FoxPro2.6 - which, by the way, can read Clipper tables easily enough.
When setting up an ODBC tag in Widows, I selected FoxPro2.6 (although I named it "Clipper")- and set the explicit location of files to a location on my PC where I placed a number of xBase tables.
Now - when executing the following code to test the feasibility of this scheme:
// odbc stuff
import java.sql.*;
class myClipper
public static void main(String[] args)
String myDatabase = "jdbc dbc:Clipper";
Connection con = DriverManager.getConnection(myDatabase, "","");

Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);

while ( )
System.out.println( rs.getString("COMP_NA")+" "+rs.getString("TITLE") );

catch (ClassNotFoundException e)
System.out.println("\""+ e.toString()+"\"" );
catch (SQLException e)
System.out.println( "\""+e.toString()+"\"" );
When executing, I get the following error:
"java.lang.ClassNotFoundException: sun.jbdc.odbc.JdbcOdbcDriver"
Inasmuch as this is my first effort at jdbc, I imagine I've
probably made every stupid mistake in the book - so please don't
laugh too loudly at this. Any thoughts. I'm all alone here - there are no local java types around to provide support.
Avrohom Leichtling
javas man

Joined: Feb 13, 2003
Posts: 1
kundi kx

Joined: Feb 03, 2003
Posts: 10
May be a classpath problem. Make sure the necessary jar is in your classpath.
Steve Wilkinson

Joined: Oct 27, 2005
Posts: 1
I'm getting the same problem connection to an Access database, did anyone come up with a solution.

how do I check if the jar file is in the path?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33111

Welcome to JavaRanch!

You can look at the system environment CLASSPATH variable to see your path. Or if you used a more specific command line classpath, you would look there.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Wei Dai
Ranch Hand

Joined: Jun 22, 2005
Posts: 86
Hehe, a typo, jdbdc--->jdbc
I agree. Here's the link:
subject: ODBC and xBase
jQuery in Action, 3rd edition