You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Рябицкий Евгений <er...@diasoft.ru> on 2010/01/12 09:08:55 UTC

How to run 2 queries in same connections.

Hello 2 everyone!

 

I have one potential problem:

 

We have stored procedure on MS SQL Server. It's doing some job and return result in special table marked with connection id (@@SPID).

 

So next query is to get result: SELECT * FROM SpecTable WHERE spid = @@SPID

 

So these 2 queries should be in same connection (to have same @@SPID).

 

In first solution there was huge transaction wrapping around this 2 queries and I think there was same connection.

But for performance proposes I can't use one huge transaction, so I switched to explicit transaction (to not have any transaction). 

Now I am not sure how to make sure that these queries are performed in same connections???

 

Evgeny.

 


Re: How to run 2 queries in same connections.

Posted by Evgeny Ryabitskiy <ev...@gmail.com>.
Up!
Tried both InternalTransaction and ExternalTransaction for it...

InternalTransaction - helps. connections is same.

ExternalTransaction  - not. Connection ID is changed.... :/



Evgeny.


12 января 2010 г. 11:08 пользователь Рябицкий Евгений
<er...@diasoft.ru> написал:
> Hello 2 everyone!
>
>
>
> I have one potential problem:
>
>
>
> We have stored procedure on MS SQL Server. It's doing some job and return result in special table marked with connection id (@@SPID).
>
>
>
> So next query is to get result: SELECT * FROM SpecTable WHERE spid = @@SPID
>
>
>
> So these 2 queries should be in same connection (to have same @@SPID).
>
>
>
> In first solution there was huge transaction wrapping around this 2 queries and I think there was same connection.
>
> But for performance proposes I can't use one huge transaction, so I switched to explicit transaction (to not have any transaction).
>
> Now I am not sure how to make sure that these queries are performed in same connections???
>
>
>
> Evgeny.
>
>
>
>