@Override
    protected void writeUserInfo(CmsSetupDb dbCon, String id, String key, Object value) {

        String query = readQuery(QUERY_INSERT_CMS_USERDATA);

        try {
            // Generate the list of parameters to add into the user info table
            List<Object> params = new ArrayList<Object>();
            params.add(id);
            params.add(key);
            params.add(value.getClass().getName());

            dbCon.updateSqlStatement(query, null, params);
        } catch (SQLException e) {
            e.printStackTrace();
        }

        // update user_info in this special way because of using blob

        boolean wasInTransaction = false;

        CmsSetupDBWrapper db = null;

        try {

            wasInTransaction = !dbCon.getConnection().getAutoCommit();
            if (!wasInTransaction) {
                dbCon.getConnection().setAutoCommit(false);
            }

            String stmt = readQuery(QUERY_ORACLE_USERDATA_UPDATE);

            // Generate the list of parameters to add into the user info table
            List<Object> params = new ArrayList<Object>();
            params.add(id);
            params.add(key);

            db = dbCon.executeSqlStatement(stmt, null, params);
            if (db.getResultSet().next()) {

                // write serialized user info
                OutputStream output = CmsUserDriver.getOutputStreamFromBlob(db.getResultSet(), "DATA_VALUE");
                output.write(CmsDataTypeUtil.dataSerialize(value));
                output.close();

            } else {
                System.out.println("Could not insert blob");
            }

            if (!wasInTransaction) {
                CmsSetupDBWrapper db2 = null;
                try {
                    String commit = readQuery("Q_COMMIT");
                    db2 = dbCon.executeSqlStatement(commit, null);
                } finally {
                    if (db2 != null) {
                        db2.close();
                    }
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {

            // close result set
            if (db != null) {
                db.close();
            }

            // rollback
            CmsSetupDBWrapper db2 = null;
            try {
                if (!wasInTransaction) {
                    String rollback = readQuery("Q_ROLLBACK");
                    db2 = dbCon.executeSqlStatement(rollback, null);
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                if (db2 != null) {
                    db2.close();
                }
            }

            // set auto commit back to original value
            try {
                if (!wasInTransaction) {
                    dbCon.getConnection().setAutoCommit(true);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
@ Override protected void writeUserInfo ( CmsSetupDb dbCon , String id , String key , Object value ) { String query = readQuery ( QUERY_INSERT_CMS_USERDATA ) ; try { List < Object > params = new ArrayList < Object > ( ) ; params . add ( id ) ; params . add ( key ) ; params . add ( value . getClass ( ) . getName ( ) ) ; dbCon . updateSqlStatement ( query , null , params ) ; } catch ( SQLException e ) { e . printStackTrace ( ) ; } boolean wasInTransaction = false ; CmsSetupDBWrapper db = null ; try { wasInTransaction = ! dbCon . getConnection ( ) . getAutoCommit ( ) ; if ( ! wasInTransaction ) { dbCon . getConnection ( ) . setAutoCommit ( false ) ; } String stmt = readQuery ( QUERY_ORACLE_USERDATA_UPDATE ) ; List < Object > params = new ArrayList < Object > ( ) ; params . add ( id ) ; params . add ( key ) ; db = dbCon . executeSqlStatement ( stmt , null , params ) ; if ( db . getResultSet ( ) . next ( ) ) { OutputStream output = CmsUserDriver . getOutputStreamFromBlob ( db . getResultSet ( ) , "DATA_VALUE" ) ; output . write ( CmsDataTypeUtil . dataSerialize ( value ) ) ; output . close ( ) ; } else { System . out . println ( "Could not insert blob" ) ; } if ( ! wasInTransaction ) { CmsSetupDBWrapper db2 = null ; try { String commit = readQuery ( "Q_COMMIT" ) ; db2 = dbCon . executeSqlStatement ( commit , null ) ; } finally { if ( db2 != null ) { db2 . close ( ) ; } } } } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { if ( db != null ) { db . close ( ) ; } CmsSetupDBWrapper db2 = null ; try { if ( ! wasInTransaction ) { String rollback = readQuery ( "Q_ROLLBACK" ) ; db2 = dbCon . executeSqlStatement ( rollback , null ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { if ( db2 != null ) { db2 . close ( ) ; } } try { if ( ! wasInTransaction ) { dbCon . getConnection ( ) . setAutoCommit ( true ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } } }
@see org.opencms.setup.db.update6to7.CmsUpdateDBCmsUsers#writeUserInfo(org.opencms.setup.CmsSetupDb, java.lang.String, java.lang.String, java.lang.Object)