Results 1 to 2 of 2
  1. #1
    lduren is offline Member
    Join Date
    May 2010
    Posts
    1
    Rep Power
    0

    Default connecting to a foxpro table

    Hello I have this code and it has a runtime error of run:
    java.lang.ClassNotFoundException: com.jstels.dbfdriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at Main.main(Main.java:30)
    BUILD SUCCESSFUL (total time: 0 seconds)

    Java Code:
     /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    
    //import com.jstels.dbfdriver;
    
    import java.sql.*;
    
    
    /**
     *
     * @author Lee
     */
    public class Main {
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) 
        {
    
    
            String databaseurl = "jdbc:jstels:dbf:"
                + "C:\\java\\com\\HISTORY_POS_TRXNS\\2010_POINT_OF_SALE_TRXNS.dbf";
            
            try
            {
                [B][U]Class.forName("com.jstels.dbfdriver");  // OFFENDING STATEMENT[/U][/B]
                Connection conn = DriverManager.getConnection(databaseurl);
    
                Statement stmt = conn.createStatement();
    
                // execute a query
    
                ResultSet rs = stmt.executeQuery("SELECT * FROM \"2010_POINT_OF_SALE_TRXNS.dbf\"");
    
                // read the data and put it to the console
    
                for (int j = 1; j <= rs.getMetaData().getColumnCount(); j++)
                {
                    System.out.print(rs.getMetaData().getColumnName(j) + "\t");
                }
    
                System.out.println();
    
                while (rs.next())
                {
                    for (int j = 1; j <= rs.getMetaData().getColumnCount(); j++)
                    {
                        System.out.print(rs.getObject(j) + "\t");
                    }
    
                    System.out.println();
    
                }
    
                        // close the objects
    
                rs.close();
    
                stmt.close();
    
                conn.close();
    
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
    
            }
        }

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,456
    Blog Entries
    7
    Rep Power
    20

Similar Threads

  1. error while connecting
    By jyothi_tallapaneni in forum Networking
    Replies: 0
    Last Post: 04-15-2010, 08:01 AM
  2. Replies: 1
    Last Post: 01-08-2010, 06:19 AM
  3. Connecting jsp.net with Oracle.
    By crxuz in forum JDBC
    Replies: 0
    Last Post: 07-08-2009, 10:17 AM
  4. Help connecting
    By xcallmejudasx in forum JDBC
    Replies: 3
    Last Post: 04-16-2009, 07:09 PM
  5. Connecting to DB from Applet
    By ibanez270dx in forum New To Java
    Replies: 1
    Last Post: 11-13-2007, 11:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •