• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ODBC and xBase

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.net.URL;
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May be a classpath problem. Make sure the necessary jar is in your classpath.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>Class.forName("sun.jbdc.odbc.JdbcOdbcDriver");
Hehe, a typo, jdbdc--->jdbc
 
reply
    Bookmark Topic Watch Topic
  • New Topic