Re: Foxpro database connection
From: Raquel (raquel_at_nospam.com)
Date: 06/23/04
- Previous message: Raquel: "Re: Foxpro database connection"
- In reply to: Raquel: "Re: Foxpro database connection"
- Next in thread: Tobias Besch: "Re: Foxpro database connection"
- Reply: Tobias Besch: "Re: Foxpro database connection"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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());
}
}
}
- Previous message: Raquel: "Re: Foxpro database connection"
- In reply to: Raquel: "Re: Foxpro database connection"
- Next in thread: Tobias Besch: "Re: Foxpro database connection"
- Reply: Tobias Besch: "Re: Foxpro database connection"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|