#2147: db.databases not working in GRASS 7
--------------------------+-------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Database | Version: svn-trunk
Keywords: db.databases | Platform: Unspecified
Cpu: OSX/Intel |
--------------------------+-------------------------------------------------
I just discovered that db.databases is not working in GRASS 7. Other db.*
modules seem to work OK.
{{{
db.databases location=nc_spm_08 driver=sqlite
dbmi: db_list_databases() not implemented
dbmi: db_list_databases() not implemented
ERROR: Unable to list databases
}}}
Not sure which exact version I have, but I built it 12 December 2013. I
don't know what version because g.version is not returning the version
number.
#2147: db.databases not working in GRASS 7
----------------------------------+-----------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Database | Version: svn-trunk
Keywords: db.databases, sqlite | Platform: Unspecified
Cpu: OSX/Intel |
----------------------------------+-----------------------------------------
Comment(by cmbarton):
Replying to [comment:1 martinl]:
> This is strange. Function which list databases has been implemented for
SQLite driver 14 months ago (r53597). Do you have SQLite DB driver
compiled?
>
> {{{
> db.driver -p
> }}}
Yes. SQLite works fine and shows up in the driver list
GRASS 7.0.svn (nc_spm_08):~ > db.connect -d
D1/1: Creating new default DB params with db_set_default_connection()
Default driver / database set to:
driver: sqlite
database: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
This is OK. DBF driver has no implemented function to list databases.
{{{
> GRASS 7.0.svn (nc_spm_08):~ > db.connect -d
> D1/1: Creating new default DB params with db_set_default_connection()
> Default driver / database set to:
> driver: sqlite
> database: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
>
> GRASS 7.0.svn (nc_spm_08):~ > db.connect -p
> driver: sqlite
> database: /home/neteler/grassdata/nc_spm_08/user1/sqlite/sqlite.db
> schema:
> group:
>
> GRASS 7.0.svn (nc_spm_08):~ > db.databases
> D1/1: db_d_init_error(): SQLite
> D1/1: db count = 0
> No databases found
}}}
The command
{{{
db.connect -d
D1/1: Creating new default DB params with db_set_default_connection()
Default driver / database set to:
driver: sqlite
database: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
}}}
doesn't create database, so `db.databases` doesn't list any database. You
need to run command which writes attribute data to the database.
#2147: db.databases not working in GRASS 7
----------------------------------+-----------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Database | Version: svn-trunk
Keywords: db.databases, sqlite | Platform: All
Cpu: OSX/Intel |
----------------------------------+-----------------------------------------
Comment(by neteler):
Replying to [comment:5 martinl]:
> Replying to [comment:4 neteler]:
...
> {{{
> > GRASS 7.0.svn (nc_spm_08):~ > db.databases
> > D1/1: db_d_init_error(): SQLite
> > D1/1: db count = 0
> > No databases found
> }}}
>
> The command
> {{{
> db.connect -d
> D1/1: Creating new default DB params with db_set_default_connection()
> Default driver / database set to:
> driver: sqlite
> database: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
> }}}
>
> doesn't create database, so `db.databases` doesn't list any
> database. You need to run command which writes attribute data
> to the database.
Good point.
Maybe "db.connect -d" should create the (empty) sqlite.db file to
avoid user confusion.
#2147: db.databases not working in GRASS 7
----------------------------------+-----------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Database | Version: svn-trunk
Keywords: db.databases, sqlite | Platform: All
Cpu: OSX/Intel |
----------------------------------+-----------------------------------------
Comment(by martinl):
Replying to [comment:6 neteler]:
> Maybe "db.connect -d" should create the (empty) sqlite.db file to
> avoid user confusion.
Probably, in any case it should be discussed in the separate ticket. In
this case `db.connect` should behave similarly for all supported drivers,
ie. to create directory for DBF driver, new empty database for SQLite or
PostgreSQL drivers...
#2147: db.databases not working in GRASS 7
----------------------------------+-----------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Database | Version: svn-trunk
Keywords: db.databases, sqlite | Platform: All
Cpu: OSX/Intel |
----------------------------------+-----------------------------------------
Comment(by martinl):
Replying to [comment:3 cmbarton]:
> Yes. SQLite works fine and shows up in the driver list
It's strange, as I already mentioned, function to list databases has been
implemented for SQLite driver 14 months ago. Please could you check
source:grass/trunk/db/drivers/sqlite/listdb.c in your local source code
tree.
#2147: db.databases not working in GRASS 7
----------------------------------+-----------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Database | Version: svn-trunk
Keywords: db.databases, sqlite | Platform: All
Cpu: OSX/Intel |
----------------------------------+-----------------------------------------
Comment(by cmbarton):
Replying to [comment:8 martinl]:
> Replying to [comment:3 cmbarton]:
> > Yes. SQLite works fine and shows up in the driver list
>
> It's strange, as I already mentioned, function to list databases has
been implemented for SQLite driver 14 months ago. Please could you check
source:grass/trunk/db/drivers/sqlite/listdb.c in your local source code
tree.
#2147: db.databases not working in GRASS 7
----------------------------------+-----------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Database | Version: svn-trunk
Keywords: db.databases, sqlite | Platform: All
Cpu: OSX/Intel |
----------------------------------+-----------------------------------------
Comment(by wenzeslaus):
Is something mentioned here still an issue?
If unclear state of source code is the remaining issue (as suggested by
last comments), please, check the file again. The best think to do is
probably
{{{
cd db/drivers/sqlite
svn status
}}}
However, `svn revert db/drivers/sqlite/listdb.c` and `svn up` and also
`svn diff` and `svn info` can be useful too.
#2147: db.databases not working in GRASS 7
----------------------------------+-----------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Database | Version: svn-trunk
Keywords: db.databases, sqlite | Platform: All
Cpu: OSX/Intel |
----------------------------------+-----------------------------------------
Comment(by cmbarton):
I just checked and the behavior is the same as I originally reported. I've
run this from a mapset in my nc_spm_08 location that has a functioning
SQLITE database. That is, this mapset has vectors connected to an SQLITE
database that is working correctly. Yet I still get:
{{{
db.databases location=nc_spm_08nc_spm_08
dbmi: db_list_databases() not implemented
dbmi: db_list_databases() not implemented
ERROR: Unable to list databases. Try to define correct connection settings
by db.login.
}}}
The manual defines "location" as follows:
"Default location for SQLite driver is the full path for the current
mapset. For PostgreSQL driver it's empty connection string. "
This is NOT standard usage of the word "location" in GRASS. Nonetheless,
it doesn't seem to work when I put in the proper pathname either.
{{{
db.databases location=$GISDBASE/$LOCATION_NAME/$MAPSET
dbmi: db_list_databases() not implemented
dbmi: db_list_databases() not implemented
ERROR: Unable to list databases. Try to define correct connection settings
by db.login.
}}}
Same thing happens if I specify the path to the SQLite database itself:
{{{
db.databases location=$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
dbmi: db_list_databases() not implemented
dbmi: db_list_databases() not implemented
ERROR: Unable to list databases. Try to define correct connection settings
by db.login.
}}}
Maybe the command is no longer relevant. If it doesn't work, maybe it
should be dropped from the distribution.