Hi María,

There have been improvements to geotools since 2.1 to do with postgis 
and how it handles connections. I strongly recommend you upgrade to 
geotools 2.3 to see if the problem persists.

It is also very important that you close any iterators or readers over 
over a feature collection after the iteration is complete. This will 
release the connection that the reader is holding on to.

-Justin


María José Pérez wrote:
> Hello! I´m Maria Jose. I have a question about geotools 2.1 --> 
> PostgisDataStore. I connect my project with a PostGis Data Base. My 
> source code:
> 
>         Map<String, String> params = new HashMap<String, String>();
>         params.put("dbtype", "postgis");
>         params.put("host", "localhost");
>         params.put("port", "5432");
>         params.put("database", "BBDD");
>         params.put("user", "mj");
>         params.put("passwd", "cotis");
>        
>         PostgisDataStoreFactory f = new PostgisDataStoreFactory();
>         pgDatastore = (PostgisDataStore) f.createDataStore(params);
> 
> I make several querys, like that, to the data base:    
>    
> FeatureSource fs = pgDatastore.getFeatureSource(name);
> FeatureCollection fc = fs.getFeatures();
> 
> but suddenly the program throws an exception because there are too many 
> users connected to the data base
> 
> Caused by: java.util.NoSuchElementException: Could not aquire 
> feature:org.geotools.data.DataSourceException: Connection 
> failed:org.postgresql.util.PSQLException: Backend start-up failed: 
> org.postgresql.util.PSQLException: FATAL: sorry, too many clients already
> 
>     at org.geotools.data.store.NoContentIterator.next 
> (NoContentIterator.java:37)
>     at org.geotools.feature.FeatureIterator.next(FeatureIterator.java:64)
>     at 
> org.geotools.data.collection.CollectionDataStore$1.next(CollectionDataStore.java:117)
> 
> Do you think I´m doing something wrong? I never close the connection, 
> but I think it doesn´t matter because geotools uses a pool connection. 
> Do you know how I can solve this problem?
> 
> Thank you,
> 
> María José
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


-- 
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to