File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC 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
Bookmark "ODBC and xBase" Watch "ODBC and xBase" New topic
Author

ODBC and xBase

Anonymous
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)
{
try
{
Class.forName("sun.jbdc.odbc.JdbcOdbcDriver");
String myDatabase = "jdbc dbc:Clipper";
Connection con = DriverManager.getConnection(myDatabase, "","");

Statement stmt = con.createStatement();
String query = "SELECT * COMP_NA, TITLE FROM LIBRARY";
ResultSet rs = stmt.executeQuery(query);

while (rs.next() )
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.
Thanks-
Avrohom Leichtling
javas man
Greenhorn

Joined: Feb 13, 2003
Posts: 1
import java.net.URL;
kundi kx
Greenhorn

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

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Steve,
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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Wei Dai
Ranch Hand

Joined: Jun 22, 2005
Posts: 86
>Class.forName("sun.jbdc.odbc.JdbcOdbcDriver");
Hehe, a typo, jdbdc--->jdbc
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ODBC and xBase