You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by pawan2009 <ps...@fnfr.com> on 2010/01/15 06:07:43 UTC

Embedded derby stale data problem

Hi

I have following question:

I am using multiple connections from parallel threads against an embedded
derby database.

Thread1:
add a record to a table using connection1

Thread2:
fetch a resultset using a query on the table using connection2

My problem is that connection2 does not return the newly added record even
though thread2 event happens after the event in thread1 and "auto-commit" on
the JDBC connection object is set to true.

Is there a solution to this problem?

-- 
View this message in context: http://old.nabble.com/Embedded-derby-stale-data-problem-tp27172548p27172548.html
Sent from the Apache Derby Developers mailing list archive at Nabble.com.


Re: Embedded derby stale data problem

Posted by Kristian Waagan <Kr...@Sun.COM>.
pawan2009 wrote:
> BTW, I am using:
>
> stmt = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE,
> ResultSet.CONCUR_READ_ONLY);
>
> to get the resultset while adding records in another thread.
>   

Hi,

Are you able to explain the behavior you see after having read the 
documentation below?
http://db.apache.org/derby/docs/dev/devguide/devguide-single.html#rdevconceptssur

What you describe should not happen if you indeed inserted the record 
and committed the transaction before you select from the table, but I 
know there are some special rules applying to scrollable result sets.
Maybe someone with more detailed knowledge about scrollable result sets 
can advice you better.


BTW: For future inquiries of this kind, you may be better of posting 
them to the users list.


Regards,
-- 
Kristian


Re: Embedded derby stale data problem

Posted by pawan2009 <ps...@fnfr.com>.
BTW, I am using:

stmt = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);

to get the resultset while adding records in another thread.
-- 
View this message in context: http://old.nabble.com/Embedded-derby-stale-data-problem-tp27172548p27172606.html
Sent from the Apache Derby Developers mailing list archive at Nabble.com.