On Wed, Mar 16, 2011 at 9:55 AM, Francisco <[email protected]> wrote: > Ty Jody, I'm using tomcat. With connection parameters it works fine. An also > with this: > > PostgisNGDataStoreFactory factory = new PostgisNGDataStoreFactory(); > > parameters.put(PostgisNGDataStoreFactory.DATASOURCE.key, ds); > JDBCDataStore dt = null; > try { > dt = factory.createDataStore(parameters); > } catch (IOException e1) { > // TODO Auto-generated catch block > e1.printStackTrace(); > }
GeoSever does something rather similar to that and it appears to be working, see this tutorial: http://docs.geoserver.org/latest/en/user/tutorials/tomcat-jndi/tomcat-jndi.html One thing that you're missing above is the dbtype param, which is required to tell apart one db from the other (they all have the same connection params). This code comes from the jndi factory test in our test harness: String dbtype = setup.createDataStoreFactory().getDatabaseID(); params.put(JDBCDataStoreFactory.NAMESPACE.key, "http://www.geotools.org/test"); params.put(JDBCDataStoreFactory.DBTYPE.key, dbtype); params.put(JDBCJNDIDataStoreFactory.JNDI_REFNAME.key, "ds"); JDBCDataStore dataStore = (JDBCDataStore) DataStoreFinder.getDataStore(params); (see JDBCJNDIDataSourceTest and subclasses) Cheers Andrea -- ------------------------------------------------------- Ing. Andrea Aime GeoSolutions S.A.S. Tech lead Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 962313 mob: +39 333 8128928 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ http://www.youtube.com/user/GeoSolutionsIT http://www.linkedin.com/in/andreaaime http://twitter.com/geowolf ------------------------------------------------------- ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
