public boolean execUpdateByRawSQL ( String updateRawSQL ) { boolean retVal = false ; log ( "#execUpdateByRawSQL updateRawSQL=" + updateRawSQL ) ; final Connection conn = createConnection ( ) ; try { Statement stmt = null ; // There is a possibility that the error occurs in one single update // statement. // Therefore, turn the auto commit off. conn . setAutoCommit ( false ) ; stmt = conn . createStatement ( ) ; stmt . executeUpdate ( updateRawSQL ) ; // finally,commit conn . commit ( ) ; retVal = true ; } catch ( SQLException e ) { loge ( "#execUpdateByRawSQL" , e ) ; retVal = false ; } finally { try { conn . close ( ) ; } catch ( SQLException e ) { retVal = false ; loge ( "#execUpdateByRawSQL" , e ) ; } } return retVal ; }
Execute raw SQL for update