Submitted by dylan on Sat, 2005-11-12 01:07.
Attribute management, aggregation, and editing in GRASS can be greatly improved by storing all attribute data in a relational database such as MySQL. By default GRASS will store the attributes associated with a vector dataset in a DBF table. This style of table can be easily modified by most spread sheet applications, and is conviniently stored in a single self contained file. However, the driver for accessing data stored in a DBF table has limited SQL capabilities. While this is enough for simple attribute management, aggregation and complicated table joins are not possible. For an general overview of GRASS attribute management see the official GRASS Wiki Page.
unixODBC or iODBC may also be used to connect GRASS to MySQL. See this page on how to setup an ODBC-style DSN for MySQL.
To set the default attribute storage system for a given mapset, use the command db.connect . The command v.db.connect can be used to configure the attribute storage system for a given vector file. Note that a valid account must be first setup in MySQL. For example, if a user wanted to store all attribute data for a new mapset into the mysql database called 'test', the following commands would be used:
db.login user=user-name password=my-password driver=mysql database=host=localhost,dbname=test
db.connect driver=mysql database=host=localhost,dbname=test
If an existing mapset has attribute data stored in DBF files, a new connection to a MySQL database is still possible. However, it is best to keep all attribute for a given mapset in a single type of database.