I set "AutoCommit" flag for java.sql.Connection object as false when executing SPARQL Query but the flag is ignored. Given below is the part of the code that executes the Query.
Connection conn;
OracleDataSource oracleDataSource;
try {
oracleDataSource = new OracleDataSource();
oracleDataSource.setURL("");
oracleDataSource.setUser("");
oracleDataSource.setPassword("");
conn = oracleDataSource.getConnection();
conn.setAutoCommit(false);
} catch (SQLException e) {
LOGGER.error("Exception occurred in preparing connection: ", e.getMessage());
throw (e);
}
String sparqlInsertQuery = "BEGIN SEM_APIS.UPDATE_MODEL('RDF_MODEL','xxxxxxxx'); END;";
try (Statement stmt = conn.createStatement()) {
stmt.executeUpdate(sparqlInsertQuery);
} catch (SQLException e) {
LOGGER.error("Cannot Execute Query: ", e);
throw (e);
}
//conn.commit();
conn.close();
Eventhough I have added "conn.setAutoCommit(false);", the statement "stmt.executeUpdate(sparqlInsertQuery);" commits the Triples into the Model. Instead of SPARQL Query, if I use SQL Query, the "AutoCommit" flag value is considered and everything works fine.