Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2002
    Posts
    2

    Question Unanswered: Command to turn autocommit off/on??

    Greetings,

    I am building a web app in ColdFusion with DB2 (UDB Workgroup Unlimited v7.1) as the backend. I need to have autocommit set to off. Either by having my app send a command (more preferable), or can I just set the DB2 server to always be autocommit off (not as preferable but acceptable).
    I could not find anything in the ODBC setup on the web server, nor a command. Am I missing it?

    tia,

    John

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Command to turn autocommit off/on??

    I think setting the db2cli.ini parameter
    AUTOCOMMIT=0
    for the db alias at every client which accesses the database should do the trick ...

    HTH

    Cheers

    Sathyaram

    Originally posted by s1devwiz
    Greetings,

    I am building a web app in ColdFusion with DB2 (UDB Workgroup Unlimited v7.1) as the backend. I need to have autocommit set to off. Either by having my app send a command (more preferable), or can I just set the DB2 server to always be autocommit off (not as preferable but acceptable).
    I could not find anything in the ODBC setup on the web server, nor a command. Am I missing it?

    tia,

    John

  3. #3
    Join Date
    Oct 2002
    Posts
    18

    Re: Command to turn autocommit off/on??

    Hi,

    We have a Java apllication with UDB as a databse.
    We are making autocommit off on the application level. You can try the following.
    After you get connection :
    Connection l_objConnection = DriverManager.getConnection(DBNAME,DBUSERNAME,DBPA SSWORD);
    l_objConnection.setAutoCommit(false);


    When I tried it didn't work through db2cli.ini.



    Warm Regards

  4. #4
    Join Date
    Aug 2002
    Posts
    12

    Smile Re: Command to turn autocommit off/on??

    Just to let you know....
    ‚hf your application is written in Java,( as you said that it's Web application ) "autocommit on " is the default spec of JDBC.( not the problem of DB2)
    In Java world, when you need a transaction processing , you have to change autocommit to "off" before creating a database connection.
    Please see http://java.sun.com/j2se/1.4/docs/gu...n.html#1004665
    for JDBC spec.

    Generally, if you're not in Java world, DB2 usually doesn't "autocommit"( except Command Line Processor of which default is autocommit=on )

  5. #5
    Join Date
    Nov 2002
    Posts
    2

    Thumbs up

    Thank you Sathyaram,

    That worked. After the change, I needed to force the server to reestablish its ODBC connection before the change took effect. (I rebooted, although I probably could have done it by stopping the service(s) and restarting them)

    John

  6. #6
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    You can create another alias for the same database with AUTOCOMMIT=1 (the default) ... If you have another application which wants autocommit on, the above alias can be used ...

    Though obvious, I thought it will be worth mentioning ...

    Cheers

    Sathyaram
    Originally posted by s1devwiz
    Thank you Sathyaram,

    That worked. After the change, I needed to force the server to reestablish its ODBC connection before the change took effect. (I rebooted, although I probably could have done it by stopping the service(s) and restarting them)

    John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •