1databaseintro(1) Grass User's Manual databaseintro(1)
2
3
4
6 Attribute management in general
7 GRASS can be linked to one or many database management systems (DBMS).
8 The db.* set of commands provides basic SQL support for attribute man‐
9 agement, while the v.db.* set of commands operates on the vector map
10 (see Vector introduction).
11
12 Available drivers
13 Available drivers are listed in SQL support in GRASS GIS.
14
15 Notes:
16 The default DBF driver provides only very limited SQL support (as DBF
17 is not an SQL DB) while the other DBMS backends (such as PostgreSQL,
18 MySQL etc) provide full SQL support since the SQL commands are sent
19 directly to the DBMS.
20
21 DB connection management
22 The current database management settings are shown or modified with
23 db.connect for current mapset. Available DBMI drivers are listed with
24 db.drivers. Some DBMI backends require a user/password for driver/data‐
25 base to be set with db.login. In order to test a driver, run db.test.
26
27 Attribute data import and export
28 Attribute data can be imported with db.in.ogr from various formats and
29 exported with db.out.ogr. To internally copy a a full table or selec‐
30 tively parts of it, use db.copy.
31
32 Further conversion tools:
33
34 MDB Tools: Convert MS-Access data to SQL, DBF, etc.
35
36 Openoffice.org with SQL Databases
37
38 SQL commands
39 GRASS supports to main SQL operations, execution of an SQL statement
40 (db.execute) and selection of data from a table (db.select). See the
41 SQL help page for examples.
42
43 Managing the default DBMI settings
44 Per default vector map attributes are stored in DBF table files. This
45 default definition can be modified with db.connect. If an external DBMS
46 is used, db.login may be required.
47
48 Creating a database
49 Specific commands are explained on the individual driver pages (these
50 pages are only available if driver was compiled in this installation):
51
52 DBF: see DBF page
53
54 SQLite: SQLite page
55
56 mySQL: meSQL pages
57
58 ODBC: ODBC page (connect to Oracle, etc.)
59
60 PostgreSQL: PostgreSQL and PostGIS page
61
62 Metadata
63 All columns for a given table are listed with db.columns. The command
64 db.describe describes a table in detail. To list all available tables
65 for a given database, run db.tables.
66
67 Table maintenance
68 To drop a column from a selected attribute table, use db.dropcol. With
69 db.droptable an attribute table can be deleted.
70
71 Database Schema
72 Currently schema support only works for PostgreSQL connections. Default
73 schema can be set with db.connect. Note that the default schema will be
74 used by all db.* modules.
75
76 db.tables returns 'schema.table' if schemas are available in the data‐
77 base.
78
79 See also
80 Introduction to GRASS vector map processing
81
82 Introduction to GRASS raster map processing
83 Main index - database index - full index
84
85 Last changed: $Date: 2008-02-10 18:09:01 +0100 (Sun, 10 Feb 2008) $
86
87
88
89GRASS 6.3.0 databaseintro(1)