public Connection getConnection() throws SQLException {
        if (connection != null) {
            return connection;
        }
        String connectionString = getConnectionString();
        String jdbcDriver = getJDBCDriverClass();
        if (jdbcDriver != null) {
            try {
                Class.forName(getJDBCDriverClass());
            } catch (ClassNotFoundException e) {
                throw new RuntimeException(e);
            }
        }
        connection = DriverManager.getConnection(connectionString);
        connection.setAutoCommit(false);

        return connection;
    }
Override this any optimizations you want to do on the db
before writing/reading.

@return
@throws IOException
tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/db/JDBCUtil.java