About DB connections pool

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

About DB connections pool

Maurzio Boriani
Hi all,
        I've written a class named PGConnectionsPoll, which is (as name say
:) ) a
connection pool 'manager' for postgres. It has a method named 'query'
which
find a 'free' connection  in pool and use it to return a result
dictionary and then
release used connection.

        How it's possible to instance it only one time in my seaside web app
and use it (the instance, not class) from every component ?

thanks in advance for reply.

bye

--
Maurizio Boriani
GPG key: 0xCC0FBF8F
  => E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F <=

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: About DB connections pool

Boris Popov, DeepCove Labs (SNN)
Create a class variable called 'Default' on PGConnectionsPool, then
implement

PGConnectionsPool class>>default

 ^Default ifNil: [Default := self new].

then use "PGConnectionsPool default" every time you need to access it from
anywhere you wish.

Cheers!

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Maurzio
Boriani
Sent: Wednesday, May 24, 2006 10:44 AM
To: [hidden email]
Subject: [Seaside] About DB connections pool

Hi all,
        I've written a class named PGConnectionsPoll, which is (as name say
:) ) a
connection pool 'manager' for postgres. It has a method named 'query'
which
find a 'free' connection  in pool and use it to return a result
dictionary and then
release used connection.

        How it's possible to instance it only one time in my seaside web app
and use it (the instance, not class) from every component ?

thanks in advance for reply.

bye

--
Maurizio Boriani
GPG key: 0xCC0FBF8F
  => E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F <=

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: About DB connections pool

Maurzio Boriani
On 2006-05-24 19:45:48 +0200 Boris Popov <[hidden email]>
wrote:

> Create a class variable called 'Default' on PGConnectionsPool, then
> implement
>
> PGConnectionsPool class>>default
>
> ^Default ifNil: [Default := self new].
>
> then use "PGConnectionsPool default" every time you need to access it
> from
> anywhere you wish.

ok, but in this way the PGConnectionsPool instance is available from
the whole system.
Is there a way to have it available only from seaside components/apps ?

thanks in advance :)

bye

--
Maurizio Boriani
GPG key: 0xCC0FBF8F
  => E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F <=

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: About DB connections pool

Boris Popov-4
Maurzio Boriani wrote:

> On 2006-05-24 19:45:48 +0200 Boris Popov <[hidden email]> wrote:
>
>> Create a class variable called 'Default' on PGConnectionsPool, then
>> implement
>>
>> PGConnectionsPool class>>default
>>
>> ^Default ifNil: [Default := self new].
>>
>> then use "PGConnectionsPool default" every time you need to access it
>> from
>> anywhere you wish.
>
> ok, but in this way the PGConnectionsPool instance is available from the
> whole system.
> Is there a way to have it available only from seaside components/apps ?
>

Give that there isn't such a separation between 'system' and 'seaside
application' this doesn't quite apply. You could define the variable
somewhere else, but that's about it if I understand you correctly.

Cheers!

-Boris
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: About DB connections pool

Maurzio Boriani
On 2006-05-26 03:20:22 +0200 Boris Popov <[hidden email]> wrote:

> Give that there isn't such a separation between 'system' and 'seaside
> application' this doesn't quite apply. You could define the variable
> somewhere else, but that's about it if I understand you correctly.

may be I found :) I subclassed WAApplication and add it an instance var
(dbPoll) with its access method (which return a new dbPool if nil).

This seems to works as expected :)

thanks,

bye

--
Maurizio Boriani
GPG key: 0xCC0FBF8F
  => E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F <=

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: About DB connections pool

Boris Popov-4
Maurzio Boriani wrote:

> On 2006-05-26 03:20:22 +0200 Boris Popov <[hidden email]> wrote:
>
>> Give that there isn't such a separation between 'system' and 'seaside
>> application' this doesn't quite apply. You could define the variable
>> somewhere else, but that's about it if I understand you correctly.
>
> may be I found :) I subclassed WAApplication and add it an instance var
> (dbPoll) with its access method (which return a new dbPool if nil).
>
> This seems to works as expected :)
>

Doesn't mean its limited to Seaside apps though,

WAApplication allInstances collect: [:ea | ea dbPool]

But like I said, so long as you don't think of it as means of limiting
the access, localizing these types of the things on a per-application
basis sounds fine to me.

Cheers!

-Boris
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: About DB connections pool

Maurzio Boriani
On 2006-05-26 16:20:11 +0200 Boris Popov <[hidden email]> wrote:

>> may be I found :) I subclassed WAApplication and add it an instance
>> var
>> (dbPoll) with its access method (which return a new dbPool if nil).
>>
>> This seems to works as expected :)
>>
>
> Doesn't mean its limited to Seaside apps though,
>
> WAApplication allInstances collect: [:ea | ea dbPool]
>
> But like I said, so long as you don't think of it as means of
> limiting the
> access, localizing these types of the things on a per-application
> basis
> sounds fine to me.

obviously on a smalltalk system I don't expect to have something
'private', 'isolated' and 'secure' at 100% (at least without the use
of some
capability system). But this (an instance per seaside app) wa
exactly what I was looking for :)

thanks for your help :)

bye

--
Maurizio Boriani
GPG key: 0xCC0FBF8F
  => E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F <=

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: About DB connections pool

tblanchard
My strategy is to create a class variable on my session class and  
stick it there if its an application global.

Just one more option for you.

-Todd Blanchard

On May 26, 2006, at 8:19 AM, Maurzio Boriani wrote:

> On 2006-05-26 16:20:11 +0200 Boris Popov <[hidden email]> wrote:
>
>>> may be I found :) I subclassed WAApplication and add it an  
>>> instance var
>>> (dbPoll) with its access method (which return a new dbPool if nil).
>>> This seems to works as expected :)
>> Doesn't mean its limited to Seaside apps though,
>> WAApplication allInstances collect: [:ea | ea dbPool]
>> But like I said, so long as you don't think of it as means of  
>> limiting the access, localizing these types of the things on a per-
>> application basis sounds fine to me.
>
> obviously on a smalltalk system I don't expect to have something
> 'private', 'isolated' and 'secure' at 100% (at least without the  
> use of some
> capability system). But this (an instance per seaside app) wa
> exactly what I was looking for :)
>
> thanks for your help :)
>
> bye
>
> --
> Maurizio Boriani
> GPG key: 0xCC0FBF8F
>  => E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F <=
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: About DB connections pool

Maurzio Boriani
On 2006-05-27 01:45:17 +0200 Todd Blanchard <[hidden email]> wrote:

> My strategy is to create a class variable on my session class and  
> stick it
> there if its an application global.
>
> Just one more option for you.

thanks a lot for suggestion but until now I'm quite happy with the
WAApplication
subclass :) I feel this a clearer design but it's only my opinion :))

thanks,

bye

--
Maurizio Boriani
GPG key: 0xCC0FBF8F
  => E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F <=

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside