I am having trouble populating the JChem table via the API. The code:
public static void addCalcdProducts(String molStr, int rxnId,
String calcProds) throws DBException {
final String SELF = "ReactorResultsRW.addCalcdProducts: ";
UpdateHandler uh = null;
ConnectionHandler conHandler = null;
try {
conHandler = getConnectionHandler();
final String[] existingCalcdProds =
getCalcdProducts(conHandler, molStr, rxnId);
final String rxnName = getName(conHandler, rxnId);
if (Utils.isEmpty(existingCalcdProds)) {
final String addlCols =
joinAll(REACT_RXN_ID, REACT_CALCD_PRODS).toString();
debugPrint(SELF + "storing calculated products ",
calcProds, " for starting materials ", molStr,
" and reaction ", rxnName, " (ID ", rxnId, "); "
+ "addlCols = ", addlCols);
uh = new UpdateHandler(conHandler,
UpdateHandler.INSERT, REACTOR_RESULTS, addlCols);
uh.setStructure(molStr);
uh.setValueForAdditionalColumn(1, rxnId);
uh.setValueForAdditionalColumn(2, calcProds);
uh.execute();
} else debugPrint(SELF + "products for starting materials ",
molStr, " and reaction ", rxnName, " (ID ", rxnId,
") already in database: ", existingCalcdProds);
} catch (PropertyNotSetException e) {
alwaysPrint(SELF + "caught PropertyNotSetException.");
e.printStackTrace();
throw new DBException(e.getMessage());
} catch (SQLException e) {
alwaysPrint(SELF + "caught SQLException.");
e.printStackTrace();
throw new DBException(e.getMessage());
} finally {
try {
if (uh != null) uh.close();
} catch (SQLException e) { ; }
Connection con = conHandler.getConnection();
closeConnection(con);
} // try
} // addCalcdProducts(String, int, String)
The debug output:
ReactorResultsRW.addCalcdProducts: storing calculated products CCCC#[C-] for starting materials CCCC#C and reaction NaH (ID 203); addlCols = rxn_id, calcd_products
SynthScheme.isResponseMatching: unknown exception: null
java.lang.NullPointerException
at chemaxon.jchem.db.UpdateHandlerOracle.getCLOB(UpdateHandlerOracle.java:50)
at chemaxon.jchem.db.UpdateHandler.setValuesForPstmt(UpdateHandler.java:2011)
at chemaxon.jchem.db.UpdateHandler.execute(UpdateHandler.java:2342)
at chemaxon.jchem.db.UpdateHandler.execute(UpdateHandler.java:2240)
at com.epoch.db.ReactorResultsRW.addCalcdProducts(ReactorResultsRW.java:58)
at com.epoch.synthesis.SynthSolver.getProducts(SynthSolver.java:191)
The structure of the relevant JChem table:
SQL> describe reactor_results_v3;
Name Null? Type
----------------------------------------- -------- ----------------------------
CD_ID NOT NULL NUMBER(10)
CD_STRUCTURE NOT NULL BLOB
CD_SMILES VARCHAR2(4000)
CD_FORMULA VARCHAR2(100)
CD_SORTABLE_FORMULA VARCHAR2(500)
CD_MOLWEIGHT FLOAT(126)
CD_HASH NOT NULL NUMBER(10)
CD_FLAGS VARCHAR2(20)
CD_TIMESTAMP NOT NULL DATE
CD_PRE_CALCULATED NOT NULL NUMBER(1)
CD_FP1 NOT NULL NUMBER(10)
CD_FP2 NOT NULL NUMBER(10)
CD_FP3 NOT NULL NUMBER(10)
CD_FP4 NOT NULL NUMBER(10)
CD_FP5 NOT NULL NUMBER(10)
CD_FP6 NOT NULL NUMBER(10)
CD_FP7 NOT NULL NUMBER(10)
CD_FP8 NOT NULL NUMBER(10)
CD_FP9 NOT NULL NUMBER(10)
CD_FP10 NOT NULL NUMBER(10)
CD_FP11 NOT NULL NUMBER(10)
CD_FP12 NOT NULL NUMBER(10)
CD_FP13 NOT NULL NUMBER(10)
CD_FP14 NOT NULL NUMBER(10)
CD_FP15 NOT NULL NUMBER(10)
CD_FP16 NOT NULL NUMBER(10)
RXN_ID NUMBER(38)
CALCD_PRODUCTS CLOB
Is the CLOB causing the problem, or something else?
BTW, the connection handler appears to be working properly now, as I can query the table (although it is currently empty).