This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ODBC and xBase

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.net.URL;
 
kundi kx
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be a classpath problem. Make sure the necessary jar is in your classpath.
 
Steve Wilkinson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Wei Dai
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>Class.forName("sun.jbdc.odbc.JdbcOdbcDriver");
Hehe, a typo, jdbdc--->jdbc
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic