// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
package updatespeed;

import java.sql.*;

public class Create {
    public static void main(String[] args) throws Exception {
        Class.forName(Config.DRIVER);
        Connection con = DriverManager.getConnection(Config.CONURL, Config.USER, Config.PASSWORD);
        Statement cre = con.createStatement();
        cre.executeUpdate("CREATE TABLE tUsers (fUsername VARCHAR(32) NOT NULL, fPassword VARCHAR(64), PRIMARY KEY (fUsername))");
        PreparedStatement ins = con.prepareStatement("INSERT INTO tUsers VALUES (?, ?)");
        for(int i = 0; i < Config.ROWS; i++) {
            ins.setString(1, "user" + i);
            ins.setString(2, Integer.toString(i));
            ins.executeUpdate();
        }
        con.close();
    }
}
