Do the work
// Load the database driver
Class.forName("jdbc.idbDriver");
System.out.println("Getting Connection");
Connection conn = DriverManager.getConnection(
DB_URL, "ian", ""); // user, password
System.out.println("Creating Statement");
Statement stmt = conn.createStatement();
System.out.println("Creating table and index");
stmt.executeUpdate("DROP TABLE userdb"); // old
stmt.executeUpdate("DROP TABLE users"); // new
stmt.executeUpdate("CREATE TABLE users (\n" +
"name char(12) PRIMARY KEY,\n" + // 1
"password char(20),\n" + // 2
"firstName char(30),\n" + // 3
"lastName char(30),\n" + // 4
"email char(40),\n" + // 5
"company char(30),\n" + // 6
"address char(30),\n" + // 7
"address2 char(30),\n" + // 8
"city char(20),\n" + // 9
"prov char(20),\n" + // 10
"country char(20),\n" + // 11
"credt date,\n" + // 12
"lastlog date,\n" + // 13
"jobDescr char(30),\n" + // 14
"opsys char(30),\n" + // 15
"unixGUI char(30),\n" + // 16
"proglang char(30),\n" + // 17
"skin char(12),\n" + // 18
"privs int\n" + // 19
")");
stmt.executeUpdate("CREATE INDEX nickIndex ON users (name)");
stmt.close();
// Database is now empty. Create the first user, out of the void
String nick = prompt("Enter admin name:");
String pass = prompt("Enter password (will echo!):");
String fname = prompt("Enter first name:");
String lname = prompt("Enter last name:");
String email = prompt("Enter admin's email:");
String city = prompt("Enter this JabaDot's city:");
String prov = prompt("Enter this JabaDot's province:");
String country = prompt("Enter this JabaDot's country:");
int privs = User.P_ADMIN | User.P_EDIT;
PreparedStatement ins =
conn.prepareStatement(UserDBJDBC.SQL_INSERT_USER);
ins.setString(1, nick);
ins.setString(2, pass);
ins.setString(3, fname);
ins.setString(4, lname);
ins.setString(5, email);
ins.setString(6, "JabaDot International");
ins.setString(7, ""); // address
ins.setString(8, ""); // address2
ins.setString(9, city);
ins.setString(10, prov);
ins.setString(11, country);
// ins.setDate(12, null);
// ins.setDate(13, null);
ins.setString(14, "JabaDot Site");
ins.setString(15, "OpenBSD");
ins.setString(16, "KDE");
ins.setString(17, "Java");
ins.setString(18, "bare_yellow");
ins.setInt(19, privs);
ins.executeUpdate();
ins.close(); // Done with this statement
conn.close(); // Done with this Connection
return; // All done with this program.