Ian Bicking wrote:
> Randall Smith wrote:
>
>> Randall Smith wrote:
>>
>>> Some questions about connections.
>>>
>>> How does one:
>>>
>>> 1. Share a SQLObject connection outside of SQLObject? Using a
>>> transaction?
>>
>>
>> Like this?
>> shared = con.getConnection()
>> ....
>> con.releaseConnection(shared)
This doesn't seem to workout with transactions. I guess the
getConnection method is getting a new connection even if con is a
transaction.
Instead, I'm doing this now.
sqlocon = connectionForURI('
postgresql://dba:...')
trans = sqlocon.transaction()
rawcon = trans._connection
# Do some stuff with SQLObject and non-SQLObject code.
# Commiting stuff here and there.
del rawcon
Calling rawcon.close() actually closes the connection. So instead I'm
using del
I'm a bit concerned about this. Is there a chance the connection could
close? Do you know a better approach?
Randall
>
>
> I think this would be fine. You don't actually have to release the
> connection, either; I think it will just be safely garbage collected if
> you don't.
>
>>> 3. Insure unused connections are closed (no pooling).
>>
>>
>> It appears that con._pool = None will do this, but is this the best way?
>
>
> For now, yes. I do use this in some of my own projects, on machines
> that are connection starved (I actually haven't had the problem of 20
> connections -- and that may be improved for you in svn trunk -- but in
> this case even 2 or 3 connections was taking up too many).
>
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play:
http://sourceforge.net/geronimo.php
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@???
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss