Opened 11 years ago
Closed 8 years ago
#2147 closed defect (fixed)
db.databases not working in GRASS 7
Reported by: | cmbarton | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.0.5 |
Component: | Database | Version: | svn-trunk |
Keywords: | db.databases, sqlite | Cc: | |
CPU: | OSX/Intel | Platform: | All |
Description
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.
build_date=2013-12-12 libgis_revision=58048
Attachments (1)
Change History (14)
follow-ups: 2 3 comment:1 by , 11 years ago
Keywords: | sqlite added |
---|
follow-up: 8 comment:3 by , 11 years ago
follow-up: 5 comment:4 by , 11 years ago
Platform: | Unspecified → All |
---|
Confirmed problem on Fedora 19:
# using older copy of NC dataset location: GRASS 7.0.svn (nc_spm_08):~ > db.drivers -p ogr sqlite dbf GRASS 7.0.svn (nc_spm_08):~ > g.gisenv set=DEBUG=1 GRASS 7.0.svn (nc_spm_08):~ > db.databases D1/1: db_d_init_error(): DBF dbmi: db_list_databases() not implemented dbmi: db_list_databases() not implemented ERROR: Unable to list databases GRASS 7.0.svn (nc_spm_08):~ > db.connect -p driver: dbf database: /home/neteler/grassdata/nc_spm_08/user1/dbf/ schema: group: 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
follow-up: 6 comment:5 by , 11 years ago
Replying to neteler:
> GRASS 7.0.svn (nc_spm_08):~ > db.databases > D1/1: db_d_init_error(): DBF > dbmi: db_list_databases() not implemented > dbmi: db_list_databases() not implemented > ERROR: Unable to list databases > > GRASS 7.0.svn (nc_spm_08):~ > db.connect -p > driver: dbf > database: /home/neteler/grassdata/nc_spm_08/user1/dbf/ > schema: > group:
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.
follow-up: 7 comment:6 by , 11 years ago
Replying to martinl:
Replying to neteler:
...
> GRASS 7.0.svn (nc_spm_08):~ > db.databases > D1/1: db_d_init_error(): SQLite > D1/1: db count = 0 > No databases foundThe 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.dbdoesn'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.
comment:7 by , 11 years ago
Replying to 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...
Martin
follow-up: 9 comment:8 by , 11 years ago
Replying to 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.
by , 11 years ago
comment:9 by , 11 years ago
Replying to martinl:
Replying to 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.
It is attached:
comment:10 by , 10 years ago
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.
comment:11 by , 10 years ago
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.
comment:12 by , 9 years ago
Milestone: | 7.0.0 → 7.0.5 |
---|
comment:13 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Tested with 7.0.5:
db.databases location=/opt/grassdata/piemonte/PERMANENT/sqlite/ driver=sqlite /opt/grassdata/piemonte/PERMANENT/sqlite//sqlite.db
Closing.
This is strange. Function which list databases has been implemented for SQLite driver 14 months ago (r53597). Do you have SQLite DB driver compiled?