Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;

public class Main {

    public static void main(String args[]) throws Exception {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection c = DriverManager
                .getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:/access.mdb");

        ResultSet rs = c.createStatement().executeQuery("select objet from Employee");

        while (rs.next()) {
            System.out.println(rs.getString("objet"));
        }
        rs.close();
        c.close();
    }
}