Search in sources :

Example 21 with SDBExceptionSQL

use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.

the class PrefixMappingSDB method insertIntoPrefixMap.

private void insertIntoPrefixMap(String prefix, String uri) {
    // Assumes not present in the persistent table.
    try {
        prefix = encode(prefix);
        String sqlStmt = sqlStr("INSERT INTO " + prefixTableName, "   VALUES (" + quoteStr(prefix) + ", " + quoteStr(uri) + ")");
        connection.execUpdate(sqlStmt);
    } catch (SQLException ex) {
        throw new SDBExceptionSQL(format("Failed to set prefix (%s,%s)", prefix, uri), ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 22 with SDBExceptionSQL

use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.

the class PrefixMappingSDB method removeFromPrefixMap.

private void removeFromPrefixMap(String prefix, String uri) {
    try {
        prefix = encode(prefix);
        String sqlStmt = sqlStr("DELETE FROM " + prefixTableName + " WHERE", //+" AND uri = "+quote(uri)
        "   prefix = " + quoteStr(prefix));
        connection.execUpdate(sqlStmt);
    } catch (SQLException ex) {
        throw new SDBExceptionSQL(format("Failed to remove prefix (%s,%s)", prefix, uri), ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 23 with SDBExceptionSQL

use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.

the class TransactionHandlerSDB method commit.

@Override
public synchronized void commit() {
    if (!inTransaction) {
        log.warn("commit: Not in a transaction");
        return;
    }
    try {
        sqlConnection.commit();
        sqlConnection.setAutoCommit(true);
        inTransaction = false;
    } catch (SQLException ex) {
        new SDBExceptionSQL("commit", ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 24 with SDBExceptionSQL

use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.

the class FormatterSimpleH2 method dropIndexes.

@Override
public void dropIndexes() {
    try {
        connection().exec("DROP INDEX IF EXISTS PredObj");
        connection().exec("DROP INDEX IF EXISTS ObjSubj");
    } catch (SQLException ex) {
        throw new SDBExceptionSQL("SQLException dropping indexes for table 'Triples'", ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 25 with SDBExceptionSQL

use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.

the class FormatterSimpleHSQL method dropIndexes.

@Override
public void dropIndexes() {
    try {
        connection().exec("DROP INDEX PredObj IF EXISTS");
        connection().exec("DROP INDEX ObjSubj IF EXISTS");
    } catch (SQLException ex) {
        throw new SDBExceptionSQL("SQLException dropping indexes for table 'Triples'", ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Aggregations

SQLException (java.sql.SQLException)47 SDBExceptionSQL (org.apache.jena.sdb.sql.SDBExceptionSQL)47 ResultSetJDBC (org.apache.jena.sdb.sql.ResultSetJDBC)8 ResultSet (java.sql.ResultSet)4 ArrayList (java.util.ArrayList)1 SDBException (org.apache.jena.sdb.SDBException)1 SDBRequest (org.apache.jena.sdb.core.SDBRequest)1 TableDescQuads (org.apache.jena.sdb.layout2.TableDescQuads)1 TableDescTriples (org.apache.jena.sdb.layout2.TableDescTriples)1 ExecutionContext (org.apache.jena.sparql.engine.ExecutionContext)1 Context (org.apache.jena.sparql.util.Context)1