In the Java JDK, there is a JDBC class, java.sql.Connection. Here is the
javadoc link:

http://java.sun.com/j2se/1.3/docs/api/java/sql/Connection.html

In Connection, there are three methods used for transactions, I will use
them in the code snippet below. Assume you have a Connection object
already, called connection...

boolean auto_commit = connection.getAutoCommit();       // save the
current auto-commit state
connection.setAutoCommit(false);

// run a bunch of database queries you want in your transaction

connection.commit();                                            //
commit the transaction to the database, completing the transaction
connection.setAutoCommit(auto_commit);                  // reset the
auto-commit state

If the auto-commit flag is true, then each individual query will be
automatically committed to the database when you call the query.
Otherwise, the queries will be stored up and committed together in a
transaction when you call commit().

Chris

-----Original Message-----
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 08, 2002 12:03 PM
To: Log4J Users List
Subject: RE: activateOptions()



Chris,

I am not familiar with the setAutoCommit method. Can you please explain
how it works and how something similar would apply to log4j? Thank you,
Ceki

At 11:54 08.01.2002 -0800, Christopher Randall wrote:
>Similar to how it works in JDBC with setAutoCommit(), I would like to
>suggest, if it doesn't already exist, that a future Log4J upgrade add
an
>auto-commit option. I have wasted a lot of time with setting options,
>them not applying, only to find out that I forgot to call the
>activateOptions() method.
>
>Thanks,
>Chris
>
>-----Original Message-----
>From: Anders Kristensen [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, January 08, 2002 11:37 AM
>To: Log4J Users List
>Subject: Re: activateOptions()
>
>
>Yes, it's to deal with the cases where two or more parameters are inter
>dependent. Say, a hostname and a port number for a network based
>appender.
>
>Anders
>
>Christopher Randall wrote:
>> 
>> Can somebody please explain to me the design idea behind
>> activateOptions()? If I call setFile(), why do I then need to call
>> activateOptions()? It seems redundant and unnecessary to have this,
>> unless ofcouse you purposely want to have transactions.
>> 
>> Are you trying to achieve transactional integrity by applying all the
>> modified options at one time?
>> 
>> Thanks for the explanation,
>> Chris
>> 
>> --
>> To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
Ceki Gülcü - http://qos.ch



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to