// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import cli.System.Data.*;
import cli.System.Data.Odbc.*;

public class DBJ {
    public static void main(String[] args) {
        OdbcConnection con = new OdbcConnection("Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=Test;User=root;Password=;");
        con.Open();
        OdbcCommand cmd = new OdbcCommand("SELECT f1,f2 FROM t1", con);
        OdbcDataReader rdr = cmd.ExecuteReader();
        while(rdr.Read()) {
            int f1 = rdr.GetInt32(0);
            String f2 = rdr.GetString(1);
            System.out.println(f1 + " " + f2);
        }
        con.Close();
    }
}
