Java Reference
In-Depth Information
/**
* Load the stats from the database.
*/
private void getStats() {
try {
this.waiting = this.processing = this.error = this.done = 0;
ResultSet rs = this.stmtStatus.executeQuery();
while (rs.next()) {
String status = rs.getString(1);
int count = rs.getInt(2);
if (status.equalsIgnoreCase("W")) {
this.waiting = count;
} else if (status.equalsIgnoreCase("P")) {
this.processing = count;
} else if (status.equals("E")) {
this.error = count;
} else if (status.equals("D")) {
this.done = count;
}
}
rs.close();
this.depth = 0;
rs = this.stmtDepth.executeQuery();
if (rs.next()) {
this.depth = rs.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* Open a connection to the database.
*/
private void open() {
try {
setTitle("Heaton Research Spider");
Class.forName(this.options.dbClass).newInstance();
this.connection =
DriverManager.getConnection(
this.options.dbURL, this.options.dbUID,
this.options.dbPWD);
this.stmtStatus = this.connection.prepareStatement(
this.sqlStatus);
Search WWH ::




Custom Search