By default GRASS 6 manages vector attributes in dBase (xBase) files. To add or remove a link between a vector map and its attribute table(s), the command v.db.connect is used. It also prints the current connection(s). We look at two maps:
v.db.connect -p roads
v.db.connect -p streams
While the roads map is linked to an attribute table, the streams map lacks it.
When using an external database, the module db.connect is used to define the connection parameters, then db.login to enter the user name and the password. This is necessary for PostgreSQL and PostGIS connections and for connections to some other databases.
A set of db.* modules are available to list table names, column names and types, to make SQL queries and to create or alter table definitions. We can query the attributes of the roads map:
echo "SELECT * FROM roads" | db.select
This works for any table depending on how GRASS is connected to a (external) database (see db.connect). A more convenient way to query associated tables is to use v.db.select. For example, we can list the attributes of the roads map with:
v.db.select roads
A report containing area sizes or line lengths is generated with v.report.