How do I in JDBC read a possibly null double value from resultSet?

double d = rs.getDouble(1);
if (rs.wasNull()) {
  // do something
} else {
  // use d

that's JDBC. If the column was null, the double value is considered "bad", so you should check using wasNull() every time you read a primitive that is nullable in the database.

Depending on your JDBC driver and database, you may be able to use a boxed type and cast:

Double doubleValueOrNull = (Double)rs.getObject(1); // or .getObject("columnName")

It will be null if the column was NULL.

Be careful to check this still works if you change database.