From: Justin D. <jde...@op...> - 2009-09-29 18:26:10
|
Hi Andrea, One thing that strikes me as off is: > params.put(JDBCDataStoreFactory.NAMESPACE.key, "/home/moovida/TMP/"); If you are trying to specify the location of the file just pout in the DATABASE key. So: params.put(JDBCDataStoreFactory.DATABASE.key, "/home/moovida/TMP/database"); So what it is doing is creating the db in the current working directory, and it could be that that db does indeed include the table. I would try cleaning the .db files and trying again. andrea antonello wrote: > Hi, I am having troubles creating a h2 connection. > Can anyone please confirm me that the following is the proper way to go: > > Map params = new HashMap(); > params.put(JDBCDataStoreFactory.DBTYPE.key, "h2"); > params.put(JDBCDataStoreFactory.DATABASE.key, "database"); > params.put(JDBCDataStoreFactory.NAMESPACE.key, "/home/moovida/TMP/"); > params.put(JDBCDataStoreFactory.PORT.key, port); > params.put(JDBCDataStoreFactory.HOST.key, host); > params.put(JDBCDataStoreFactory.USER.key, user); > params.put(JDBCDataStoreFactory.PASSWD.key, passwd); > > spatialDataStore = DataStoreFinder.getDataStore(params); > > The problem is that is when I try to create a table with: > > SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); > b.setName("testgeom"); > b.setCRS(DefaultGeographicCRS.WGS84); > b.add("the_geom", Point.class); > b.add("id", Long.class); > SimpleFeatureType featureType = b.buildFeatureType(); > spatialDataStore.createSchema(featureType); > > it complains that: > > Caused by: org.h2.jdbc.JdbcSQLException: Table testgeom already > exists; SQL statement: > CREATE TABLE "testgeom" ( "fid" int AUTO_INCREMENT(1) PRIMARY KEY, > "the_geom" BLOB COMMENT 'POINT', "id" BIGINT ) [42101-118] > > The table doesn't exist, since the command should create it. > Any idea about what I am doing wrong? > > Thanks, > Andrea > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Geotools-gt2-users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users -- Justin Deoliveira OpenGeo - http://opengeo.org Enterprise support for open source geospatial. |