A singleton for the whole applicatoin is the best way to go.  We're 
working on a 'catalog' interface, which would manage all the connections 
and featureType for you.  In GeoServer (web mapping app, produces images 
and raw data as GML using WMS and WFs standards, which you may take a look 
at for what you're doing), we just have one PostGISDataStore per database, 
and let it handle all the featureTypes.  So if you're using multiple 
tables/featureTypes, they'll all make use of the connection pool.  As for 
creating the DataStore with the connectionPool in the first place, the 
best thing to do is to use the DataStoreFinder, with just the params 
needed for the PostgisDataStoreFactory.  This will handle the creation of 
the pool, and additionally gives you the flexibility to easily swap out 
the backend data format.  Does this make sense?  

Chris

On Mon, 14 Nov 2005, Elad Messing wrote:

> Hello all !
>       I am new here, so I hope I am not asking dumb questions :)
> 
>       My question is rather simple :
>       I have a web application, that works with some PostGis Data. My
> Application Server is Tomcat, and I am using Cocoon as a
> Web-Application-Framework.
> 
>       My users ask the server for some data, I connect to the PostGis
> using the PostgisConnectionFactory, and than use the PostgisDataStore.
> 
>       Now, I have many users, and would like to use some connection
> pooling. I understand PostgisConnectionFactory will handle this for me. The
> question is - how do I treat this PostgisConnectionFactory object ? 
>       Should I initiate it the first time the application-server is
> loading ?
>       Should I initiate it in every user request ? Or maybe I should store
> it in the HTTP session of each user ?
> 
> 
>       Should I close its PostgisDataStore that I get from it ? Or maybe
> nullify them ?
>       Should I close the connection pool object I get from it ? 
> 
> 
>       Or maybe use something else, like a sort of Singleton for the whole
> application ?
> 
>       Any ideas / directions would be welcomed..
> 
>       Thank you !
> 
> Elad Messing
> 

-- 



-------------------------------------------------------
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
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to