Re: Foxpro database connection

From: Raquel (raquel_at_nospam.com)
Date: 06/23/04

  • Next message: Roedy Green: "Re: Foxpro database connection"
    Date: Wed, 23 Jun 2004 00:54:24 -0400
    
    

    A sample program for your reference. This connects and retrieves data from
    a database "SAMPLE" which has been already defined as a ODBC datasource.

    import java.sql.*;

    public class jdbc3
    {
     public static void main(String[] args)
     {
      String data = "jdbc:odbc:SAMPLE";
      try
      {
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       Connection conn =
    DriverManager.getConnection(data,"userid","password");
       Statement st = conn.createStatement();
       ResultSet rec = st.executeQuery( "SELECT DEPTNO FROM
    schema.DEPARTMENT");
       while(rec.next())
       {
        System.out.println(rec.getString("DEPTNO"));
       }
       st.close();
      } catch (Exception e)
      {
       System.out.println("Error -" + e.toString());
      }
     }
    }


  • Next message: Roedy Green: "Re: Foxpro database connection"

    Relevant Pages

    • Database software without a database
      ... it to be connected to a database such as Access or Oracle. ... I've been looking at the "dataware" sample program and trying to get ... Anteon Corporation ...
      (microsoft.public.vb.general.discussion)
    • How to Access Random to an mdb File
      ... I prepared a database within access and ... (My employee code has a primary key). ... Can anybody show me a way or maybe a sample program etc. ... Regards ...
      (microsoft.public.vb.general.discussion)