1db.connect(1)                 Grass User's Manual                db.connect(1)
2
3
4

NAME

6       db.connect   - Prints/sets general DB connection for current mapset and
7       exits.
8

KEYWORDS

10       database, SQL
11

SYNOPSIS

13       db.connect
14       db.connect help
15       db.connect  [-p]   [driver=name]    [database=name]     [schema=string]
16       [group=string]   [--verbose]  [--quiet]
17
18   Flags:
19       -p
20           Print current connection parameters and exit
21
22       --verbose
23           Verbose module output
24
25       --quiet
26           Quiet module output
27
28   Parameters:
29       driver=name
30           Driver name
31           Options: ogr,dbf,odbc,pg,mysql,sqlite,mesql
32           Default: dbf
33
34       database=name
35           Database name
36           Default: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
37
38       schema=string
39           Database schema
40           Do not use this option if schemas are not supported by driver/data‐
41           base server
42
43       group=string
44           Default group of  database  users  to  which  select  privilege  is
45           granted
46

DESCRIPTION

48       db.connect  allows  the  user to set parameters for connection to data‐
49       base. These parameters are then taken by modules as default values  and
50       user  do not need enter parameters each time. Values are stored in user
51       file; the connection is not tested for validity.
52

OPTIONS

54       Typing db.connect -p displays current connection parameters.
55

EXAMPLES

57   DBF
58       Local storage (the dbf/ subdirectory in the mapset must exist  or  must
59       be created by the user):
60
61       db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
62       db.tables -p
63
64
65   SQLite
66       Local storage:
67
68       db.connect           driver=sqlite           database='$GISDBASE/$LOCA‐
69       TION_NAME/$MAPSET/sqlite.db'
70       db.connect -p
71       db.tables -p
72
73
74       The SQLite database is created automatically when used the first time.
75
76   ODBC
77       Network storage: (may require the use of db.login):
78
79
80       db.connect driver=odbc database=gtest
81       db.login user=myname [pass=secret]
82       db.connect -p
83       db.tables -p
84
85
86   PostgreSQL
87       Network storage: (may require the use of db.login):
88
89       db.connect driver=pg database="host=myserver.itc.it,dbname=mydb"
90       db.login user=myname [pass=secret]
91       db.connect -p
92       db.tables -p
93
94
95   PostgreSQL with different port
96       Network storage: (may require the use of db.login):
97
98       db.connect                       driver=pg                        data‐
99       base="host=myserver.itc.it,dbname=mydb,port=6666"
100       db.login user=myname [pass=secret]
101       db.connect -p
102       db.tables -p
103
104
105   MySQL (local)
106       Local storage (db.login may not be needed):
107
108       db.connect driver=mysql database=mydb
109       db.login user=myname [pass=secret]
110       db.connect -p
111       db.tables -p
112
113
114   MySQL (external server)
115       Network storage: (may require the use of db.login):
116
117       db.connect driver=mysql database="host=myserver.itc.it,dbname=mydb"
118       db.login user=myname [pass=secret]
119       db.connect -p
120       db.tables -p
121
122

NOTES

124       To  connect  a  vector  map  to  a  database table, use v.db.connect or
125       v.db.addtable.
126

SEE ALSO

128        db.columns, db.drivers, db.login, db.tables, v.db.addtable,  v.db.con‐
129       nect, GRASS SQL interface
130

AUTHOR

132       Radim Blazek, ITC-Irst, Trento, Italy
133
134       Last changed: $Date: 2007-01-27 21:08:32 +0100 (Sat, 27 Jan 2007) $
135
136       Full index
137
138       © 2003-2008 GRASS Development Team
139
140
141
142GRASS 6.3.0                                                      db.connect(1)
Impressum