Statement x Commit

Hi all,
I have the following situation and I don't know what JDBC actually does:
- conn.setAutoCommit( false );
- A Statement is created and an update is executed on that Statement object
- That statement is closed and destroyed ( = null )
- conn.commit();
Question is: What happens to the changes applied by that Statement? Are they lost?
Thanks a lot for the help
Marcelo Esteves

Oddly, it depends on the DBMS you are using. You need to check the DBMS and/or drivers documentation to see what results to expect depending on what conditions. Oracle and DB2 driver work exactly the opposite. One would commit the data, while the other would roll it back. Pretty ackward, but you have to remember that on a failure, it is likely that the JDBC client is no longer connected to the database, so it cannot control the default behavior. That leaves the DBMS to clean itself up however the DBMS designers saw fit.

Similar Messages

  • REPLACE statement removing commas from a money convert... I do NOT want it to do this

    I am using a case statement to remove the '-' from a negative number and place a '(' there instead. 
    The negative side of the CASE statement is as follows:
    REPLACE(CONVERT(varchar, CONVERT(money, SUM(Begin_Balance)), 1), '-', '(') + ')'
    The positive side is:
    CONVERT(varchar, CONVERT(money, SUM(Begin_Balance)), 1)
    The data output for the positive portion is 100% correct. Here is an example of the output I receive.
    (18271.15)
    (25000.00)
    82,490.00
    45,000.00
    Why is the replace statement stripping my commas?

    >> I am using a case statement to remove the '-' from a negative number and place a '(' there instead. <<
    So many horrible fundamental errors in one sentence! 
    1.  CASE is an expression, not a statement. An expression returns a scalar value of a known data type, A statement changes the schema. 
    2. In SQL, all display formatting is done in a presentation layer, never in the database.
    3. We use the ANSI/ISO Standard  CAST()  and not the old Sybase/Unix CONVERT today
    4. We use DECIMAL() and not the old Sybase/Unix MONEY. This thing does not work; it fail to do correct math; Google it! Do a data audit and see if you can go to jail for this. 
    5. SQL is not COBOL. The COBOL language treats all data as strings. STOP DOING THAT IN SQL! This language uses abstraction in the database and the presentation does the job that your old PICTURE clause used to do. 
    Can you get a 2-3 week intro course to SQL and modern programming form your company? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Keep prepared statement across commit

    Hello everyone!
    Is there any way the Oracle keeps prepared statements across commits (same connection, same process)?
    Thank you in advance
    Wolfgang

    Caching this occurs transparently, even across sessions. No need to do anything special...

  • " *COMMIT "  statement - Question

    *XDIM_MEMBERSET P_ACCT = CE0004010
    *XDIM_MEMBERSET TIME = 2006.DEC ,2006.Nov,2006.OCT
    [#CE0661000]  = 500
    *COMMIT
    In the above logic, how many records will get updated?
    I am guessing  the above logic will update 3 records(based on teh time dimension) , is that correct?

    Dear Sapki6,
    Sorry I did not clear your script logic. If you want to create a new record into BPC table, please you have to use *REC() statement and combine with *COMMIT() statement. *COMMIT() statement is used to write down a data into tables and maybe you want to view a new record, please you do not put *COMMIT() statement in your script and BPC will write down in memory. So, you can see log of data for a new record which BPC created it.
    Kind Regards,
    Wandi Sutandi

  • Can it be used commit statement in user-exits?

    Can it be used commit statement in user-exits?
    How to badi is different from other enhancement?
    What are the two default components systems automatically creates when we create a new badi?
    What is the business object for purchase order?

    Hi,
       1) commit statement in userexit:
    You should not do that.
    After the user exits code is triggered, the transaction's own commits statements will commit the database anyway
    2)You could say: BAdI = enhancement using interfaces
    It is just the most up-to-date version of SAP's enhancement concept.
    go thru this.
    http://www.esnips.com/web/BAdI
    http://www.allsaplinks.com/badi.html
    New to Badi
    Regards
    Kiran Sure

  • Execution of ddl statement  in post-insert trigger

    hi,
    I'm working on headstart 6.5. I wants to execute a DDL statement in post-insert-trigger.The problem is this trigger is executed in between pre-commit and post-forms-commit.In pre-commit the transaction is opened with a insert statement that is inserting "open" in field status which is having a deffered check constraint QMS_NEED_TO_CLOSE_TRANSACTION.In post-forms-commit it will check whether the transaction is open if yes will check the business rule will delete the data that was inserted into qms_transaction in pre-commit trigger and will close the transaction .
         In between if i execute a DDl statement a commit will be performed on the insert statement written in pre-commit trigger.This will violate the check-constraint and we will get the error qms_need_to_close_transaction violated.
         My business logic wants this statement to be executed at the post-insert trigger on the block.Is this possible??
         Does anyone have face the same problem?Whts the workaround for the same?

    Hello,
    You could use the execute_query after the commit_form called, by exeample in a KEY-COMMIT trigger.
    KEY-COMMIT trigger
      Commit_Form ;
      Go_block( 'master_block' ) ;
      Execute_Query ;Francois

  • CALL PROCEDURE IN SQL STATEMENT

    Why we cant call a procedure inside SQL statement?

    Hitesh Nirkhey wrote:
    Hi Karthick_Arp
    as you said
    The procedure that is used inside a function cannot contain DDL or DML statements or COMMIT/ROLLBACK.
    Said that it does not make much sence to use a procedure within a function.IT make sense if we DECLARE FUNCTION AS PRAGMA AUTONOMUS_TRANSACTION
    then we can execute DDL or DML statements or COMMIT/ROLLBACK in that function.
    Regards
    HiteshBut why would you do that?

  • Commit(); - generated or not?

    I'm working through an example I found at:
    Managing ColdFusion data with Adobe Flash Builder 4 beta
    http://www.adobe.com/devnet/flex/articles/fcf_managing_data_05.html
    ... and while I'm using a Delphi 2007 web service, it is mostly working fine for me. However, one thing in the article that doesn't work is where the author uses
    service.commit();
    ... to update every record of a datagrid, and states
    The commit() function is a built-in function of the data service that will run the service that you defined as the update operation in the Data Management wizard. In this case, it is running the updateItem() function once for each record in the DataGrid control.
    In the service FB4b2 made for me, however, commit() doesn't seem to exist. I have defined an Update operation and it works fine when called separately. I'm wondering if I will just have to add code to loop through the datagrid and call the Update operation on each record. If so, is it possible to just have it update the records that have changed, rather than all of them?
    Thanks for any suggestions ...

    Thank you - you have led me to the problem. I had originally done "Enable Data Management", but I rewrote and reimported the web service. The web service operations that I had set up in code, including UPDATE, still worked fine, and I didn't realize that I had to do "Enable Data Management" again. It is, of course, obvious now :-)
    Note that if I do a "Refresh" of the web service, commit() stays around - it is when I do a "Delete" (and reload) of the web service that it goes away.
    Thanks!

  • Can call a function in the select statement?

    Is there any ways to call a function in the select statement?
    what I like to do is this:
    select deptno, totalEmployees(deptno), TotalSalary(deptno)
    from emp;
    I know it can be done by count(*) and join tables, but my case
    is much more complex and the where clauses are different from
    one function to another, and have many tables to join and many
    combinations
    Thanks

    Functions can be used in a select statement subject to certain
    restrictions, see
    http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/
    server.817/a85397/statem9b.htm#2062024
    It's under "CREATE FUNCTION> Keywords and Parameters> function>
    Restrictions on User-Defined Functions"
    Here is an except...
    When a function is called from within a query or DML statement,
    the function cannot:
    a) Have OUT or IN OUT parameters
    b) Commit or roll back the current transaction, create or roll
    back to a savepoint, or alter the session or the system. DDL
    statements implicitly commit the current transaction, so a user-
    defined function cannot execute any DDL statements.
    c) Write to the database, if the function is being called from a
    SELECT statement. However, a function called from a subquery in
    a DML statement can write to the database.
    d) Write to the same table that is being modified by the
    statement from which the function is called, if the function is
    called from a DML statement.
    Except for the restriction on OUT and IN OUT parameters, Oracle
    enforces these restrictions not only for the function called
    directly from the SQL statement, but also for any functions that
    function calls, and on any functions called from the SQL
    statements executed by that function or any function it calls.

  • Encountering transaction statement from within a PL/SQL block

    Hi All,
    i would like to know what will be the transaction status if we use an commit or a rollback statement inside a PL/SQL procedure called from within an PL/SQL package.
    For example
    BEGIN
    select statement
    insert statement 1
    .... call to <xyz> procedure
    end;
    xyz procedure
    insert statement 2
    commit/rollback
    end of procedure
    will the insert statement 1 be commited/rollbacked when the session encounters the transaction statement inside the procedure.

    Welcome to the forum!
    Unless the procedure xyz is an autonomous transaction, then yes Insert statement 1 will be committed.

  • Commit in user exit

    hi experts
    during an idoc process i am trying to do commit after inserting data to a database table in include MV45AFZZ in a user exit. the commit statement causes the idoc process to fail.
    how can i do commit in a way that won't fail the idoc process
    tahnks
    amit
    Edited by: amit walden on Jun 18, 2008 8:38 AM

    Hi,
      commit statement in userexit,You should not do that.
    After the user exits code is triggered, the transaction's own commits statements will commit the database anyway.
    Regards
    Kiran Sure

  • Which of these statements is faster?

    Hi all,
             Can anyone please tell me which of these two is faster in terms of Performance:
    Statement 1:
                          COMMIT AND WAIT.
    Statement 2:
      Call FUNCTION 'BAPI_TRANSACTION_COMMIT' .
    Kindly reply immediately as this is bit urgent.
    Regards,
    Vijay

    After the system executes the COMMIT WORK statement, it sets the attributes of each persistent object in the ABAP program to initial. (That is, it calls the IF_OS_STATE~INVALIDATE method).
    Bapi_transaction_commit... should also not take much time... useing either will not make any significant diff. provided wait time is minimal..

  • Need output with commas and decimals.

    Hi All,
               I want to print this below no using write statement with commas and decimals .
                                            123,45,67,890.12
    Note :
              It must be declared in parameters and it is currency value
    and my output must also be like this
      123,45,67,890.12
    Can any one suggest me what to or send me some sample program for this,
    (points will be rewarded)
    Thanking you
    vinoth.r

    quote:
    Originally posted by:
    The ScareCrow
    You should redesign your db to have another table
    This table should have the asset id and the category id (I
    call this a bridging table)
    The category column would then be removed from the asset
    table.
    You then do a join on the tables to gain the category
    description.
    But to fix your problem with the existing structure
    Your query
    <cfquery name="qIndex" datasource="#appDSN#">
    SELECT Asset.Reference, Asset.AssetName, Asset.Category
    FROM Asset
    WHERE Category LIKE '%#URL.Category#%'
    </cfquery>
    <cfoutput query="qIndex">
    <cfset catids = ValueList(qIndex.category])>
    <cfquery name="qCat" datasource="#appDSN#">
    Select Category_Name
    From categories
    Where Category_ID IN (#catids#)
    </cfquery>
    #qIndex.Reference#<br />
    #qIndex.AssetName#<br />
    <cfloop query="qCat">
    #qCat.Category#<br>
    </cfloop>
    </cfoutput>
    Ken
    Ken, Thanks. It's really close, but all of the repeating
    records are taking the Category output from the first record in the
    set and repeating it...e.g. if the first record is "Mouse,
    Keyboards, Trackballs", all of the subsequent records show the
    same.
    Also should "ValueList(qIndex.category])", have been
    "ValueList(qIndex.category)"?
    If there's not a way to do this using the current db, i'll
    try using a bridging table.
    thanks.
    paul

  • Login scrren appears upon commit in CRM BOL Programing.

    Dear Friends,
    I have written a report, in order to set the status of Accounts to "Terminate" and end the validity of its relationships and many things in development system(CRD). The report is running perfect in development system and now has been moved to Quality system(CRT) after proper testing. when the report is executed in the quality system on debugging when the statement lr_trax->commit( iv_force_lock = abap_true) is executed a login screen appears of the same system(CRT) for user credentials. but the same is not happening in Development system.
    Note: The Re-login is of same system CRT. we are updating the ECC system via Interfaces.
    If any of you had faced any such issue like this please help me, as it is very urgent delivery.
    Warm Regards,
    Ashraf.

    Dear Friends,
    Thanks, the issue is resolved.
    It was the issue from Basis Team.
    Thanks again
    Ashraf.

  • Exception triggering Commit work.

    Hi ,
    I need to update a seris of tables and they must be transactional, i.e. all the data must be updated or not.
    I have the following code.
    *Fetch and Update Reference Profile Data
      me->process_rp_data( ).
    *Fetch and Update Request Data
      me->process_req_data( ).
    *Fetch and Update Collateral Data
      me->process_coll_data( ).
    *Fetch and Update Project Data
      me->process_project_data( ).
      IF i_update_flag IS INITIAL.
        ROLLBACK WORK.
      ELSE.
        COMMIT WORK.
      ENDIF.
    in all the above four methods there are update statements like below
      TRY .
          UPDATE (i_table_name) SET bp_number = sur_bp WHERE (lt_dyn_cond).
          IF sy-subrc NE 0.
            me->raise_exception( EXPORTING i_text_id    = zcx_rms_dedupe_process_excptns=>error_in_update
                                           i_bp_num     = vic_bp
                                           i_guid       = i_guid
                                           i_table_name = i_table_name
                                           i_process    = i_process ).
          ENDIF.
        CATCH cx_sy_dynamic_osql_error.
          me->raise_exception( EXPORTING i_text_id    = zcx_rms_dedupe_process_excptns=>error_in_update
                                         i_bp_num     = vic_bp
                                         i_guid       = i_guid
                                         i_table_name = i_table_name
                                         i_process    = i_process ).
      ENDTRY.
    If in the third method, if the exception cx_sy_dynamic_osql_error is raised all the data that is updated in the first two methods are commited. Can any one help how to overcome this situtation. I do not want the data to be committed
    Regards

    Hi,
    My main question is that the why Exception I am raising is triggering a database commit. I am not even displaing an information message. I am simply outputing a write statement
    [DataBase Commit|http://help.sap.com/saphelp_nw70/helpdata/en/41/7af4bca79e11d1950f0000e82de14a/content.htm]
    Gives more information on Database commit but it does not mention this case. So wanted to know my mistake.

Maybe you are looking for

  • Short dump in alv

    hello gurus, while i running sales report in production it foin into short dump and in error message indicates low memory space into internal table while last select quary executes. also  i want make u sure in production while am execute for one motn

  • "No more data to read from socket."?

    Hi everybody, We recently migrated from Oracle 10g Database Enterprise Edtion to Oracle 11g R2 Database Enterprise Edition with Data Guard and a dedicated standy-by database. The database is a data source for multiple applications. Among others, we a

  • Where has Alt V gone in Itunes 12

    When manually entering track- and artistinfo I often used Alt V to proceed to next track. Why has it vanished in I-tunes12? Why have Album Artist and artist fields been put on separate tabs? It is a bit of a nuisance to have to go to  different tabs

  • Help!  I have windows Vista!

    So I just got Window's Vista (ugh), and I installed my i-tunes yesterday. It will add the songs to the library and convert *wma files, but when I click on songs to listen to them, they won't play. The song shows up at the top where it displays the so

  • Can nort start  OC4J_BI_FORM  after Portal password change(9.0.4)

    We changed PORTAL password by going top sqlplus and OAS. Thinking it will make changes at both places. Now we see that when we start OAS. OC4J_BI_FORM does not start???