Skip to Content.
Sympa Menu

freetds - RE: Transaction problems...

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Kalyan Chakaravarthy <nkalyanc2000 AT yahoo.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: RE: Transaction problems...
  • Date: Fri, 4 Jan 2002 20:03:55 -0800 (PST)


Hi,

You are right, As you said If I don't close the
statement and comit on connection object, it works !.
Which I see as a very strange and non-standard
behaviour.

In my case, I am calling lot of objects as part of
transaction. I have no way to say execute on the same
statement as they open and close statements of their
own.

Now, I need to modify my code to pass statement to
other objects!.

Driver dictates the behaviour of objects !!!

Thanks for the reply,
Kalyan.

--- nnklak AT yahoo.com wrote:
> Hi, I am facing a similar problem, the question is:
>
> Why the following code does NOT work (no inserts in
> the DB)
> Connection.setAutoCommit(false);
> Statement stInsertSQL =
> Connection.createStatement();
> stInsertSQL.execute("INSERT INTO table1
> values(1,2)");
> st.close();
> Connection.commit();
> Connection.setAutoCommit(true);
> Connection.close();
>
> While the following code seems to work:
> Connection.setAutoCommit(false);
> Statement stInsertSQL =
> Connection.createStatement();
> stInsertSQL.execute("INSERT INTO table1
> values(1,2)");
> //st.close();
> Connection.commit();
> st.close();
> Connection.setAutoCommit(true);
> Connection.close();
>
> I have to insert 500 rows in the DB as a
> transaction; Do I have to keep
> 500 Statement variables until the
> Connection.commit()statement ?
>
> Thanks
> - Nikolas
>
> ---
> You are currently subscribed to freetds as:
> [nkalyanc2000 AT yahoo.com]
> To unsubscribe, forward this message to
$subst('Email.Unsub')


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/




Archive powered by MHonArc 2.6.24.

Top of Page