Commits or rollbacks issued following each select

J

Jim

I have an application that uses the direct provider for Oracle to
connect to an Oracle database server. While looking at Oracle trace
files, I discovered something that bothers me. The following
pseudo-code describes the problem.

string statement = "Select fielda, fieldb from tablea where fieldc =
:param1";

DbCommand.CommandType = CommandType.Text;
DbCommand.CommandText = statement;
DbCommand.Connection = current connection;
DataAdapter.SelectCommand = DbCommand;
try
{
DataAdapter.Fill(dataTable);
}
etc...

This is a simple select on a non-unique field that returns zero or more
rows. It works fine. However, when I look at the Oracle trace files,
after the last fetch, I see:
XCTEND rlbk=1, rd_only=1

Sometimes rlbk = 0, other times it is as above. This is telling Oracle
do do a commit or rollback on the read. I am not in a transaction. This
appears to happen with all reads, none of which were in an explicit
transaction.

I have seen references to this behavior elsewhere, but have found no
way to disable it. I tried both the MS and Oracle data providers, with
no apparent change in behavior. It's wasting time on the app server,
network and database server. Can anyone tell me how to disable this
"feature"?

Thanks in advance,

Jim Brandley
 
D

David Browne

Jim said:
I have an application that uses the direct provider for Oracle to
connect to an Oracle database server. While looking at Oracle trace
files, I discovered something that bothers me. The following
pseudo-code describes the problem.

string statement = "Select fielda, fieldb from tablea where fieldc =
:param1";

DbCommand.CommandType = CommandType.Text;
DbCommand.CommandText = statement;
DbCommand.Connection = current connection;
DataAdapter.SelectCommand = DbCommand;
try
{
DataAdapter.Fill(dataTable);
}
etc...

This is a simple select on a non-unique field that returns zero or more
rows. It works fine. However, when I look at the Oracle trace files,
after the last fetch, I see:
XCTEND rlbk=1, rd_only=1

Sometimes rlbk = 0, other times it is as above. This is telling Oracle
do do a commit or rollback on the read. I am not in a transaction. This
appears to happen with all reads, none of which were in an explicit
transaction.

I have seen references to this behavior elsewhere, but have found no
way to disable it. I tried both the MS and Oracle data providers, with
no apparent change in behavior. It's wasting time on the app server,
network and database server. Can anyone tell me how to disable this
"feature"?

In Oracle you are always in a transaction. Autocommit mode is emulated by
issuing a commit after each statement.

David
 
D

David Browne

Jim said:
I really do not want autocommit. Is there a way to turn it off?

Just use explicit transactions (or System.Transactions in ADO.NET 2.0) in
your ADO.NET code. All ADO.NET data providers default to autocommit mode.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top