-------- Original-Nachricht -------- > Datum: Tue, 17 May 2011 16:39:31 +0200 > Von: "Johannes Radinger" <[email protected]> > An: Markus Neteler <[email protected]> > CC: [email protected] > Betreff: Re: [GRASS-user] sqlite database connection problems
> > -------- Original-Nachricht -------- > > Datum: Tue, 17 May 2011 15:50:51 +0200 > > Von: Markus Neteler <[email protected]> > > An: Johannes Radinger <[email protected]> > > CC: GRASS user list <[email protected]> > > Betreff: Re: [GRASS-user] sqlite database connection problems > > > On Tue, May 17, 2011 at 2:01 PM, Johannes Radinger <[email protected]> > > wrote: > > > Hello, > > > > > > I tried to delete a vector file but I got following error: > > > > > > g.remove vect=river_gen@Cele > > > Removing vector <river_gen@Cele> > > > DBMI-SQLite driver error: > > > Unable to open database: unable to open database file > > > Unable to open database </Users/Johannes > > Radinger/Documents/GRASS-GIS/Cele_location/Cele/sqlite.db/> by driver > <sqlite> > > > > The trailing slash at sqlite.db/ should not be there. > > > > ... > > > So i tried to list the the database connection and tables of my > database > > and but there is that table existing: > > > > > > db.connect -p > > > driver:sqlite > > > database:$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db/ > > > > sqlite.db is a file, with / triling GRASS may think that this indicates > a > > directory. > > > > You need to define the DB link properly. That is in the VAR > > file in the mapset (ASCII file) as well as in the dbln file of the > > vector map - you can easily fix that with a text editor. > > Be sure to avoid the trailing slash in future for the SQLite > > backend, see manual of the grass-sqlite driver. > > Oh I didn't recognize the trailing slash. > > But there are still some problems/questions I've got with sqlite database. > I created a totally new mapset (no sqlite database existing in the > beginning) and then I tried following script: > > > > input_barriers = options['barriers'] > > env = grass.gisenv() > > gisdbase = env['GISDBASE'] > location = env['LOCATION_NAME'] > mapset = env['MAPSET'] > > grass.run_command("db.connect", > driver = "sqlite", > database = > os.path.join(gisdbase,location,mapset,'sqlite.db'), > flags = "c") > > > grass.run_command("v.in.ascii", > flags = "n", > overwrite = True, > input=input_barriers, > output="barriers", > skip=1, > columns="x DOUBLE, y DOUBLE, clearance DOUBLE") > > Is there now a table in the sqlite database created or not? I don't think > so (checked with the SQlite Manager), but if I try > grass.run_command("v.db.addtable", map="barriers") it says there is already a > table linked to it. > Is there a link to the old default database although the sqlite database was > set before? It seems that I found the problem. It is the c flag in db.connect. The manual says "Check connection parameters, set if uninitialized, and exit" and uninitialized means probably totally uninitialized. So the connection isn't set to e.g sqlite if already a dbf connection exists when the c-flag is set. /johannes > > /Johannes > > > > > > > > Markus > > -- > NEU: FreePhone - kostenlos mobil telefonieren und surfen! > Jetzt informieren: http://www.gmx.net/de/go/freephone > _______________________________________________ > grass-user mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/grass-user -- Ihr GMX Postfach immer dabei: die kostenlose GMX Mail App für Android. Komfortabel, sicher und schnell: www.gmx.de/android _______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
