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=string]   [database=string]    [schema=string]
16       [group=string]
17
18   Flags:
19       -p  print current connection parameters and exit
20
21   Parameters:
22       driver=string
23           driver name: Options: dbf,mysql,ogr,pg,sqlite,mesql,odbc
24
25       database=string
26           Database name:
27
28       schema=string
29           Database schema. Don't use this option if schemas are not supported
30           by driver/database server.
31
32       group=string
33           Default group of  database  users  to  which  select  privilege  is
34           granted.
35

DESCRIPTION

37       db.connect  allows  the  user to set parameters for connection to data‐
38       base. These parameters are then taken by modules as default values  and
39       user  do not need enter parameters each time. Values are stored in user
40       file.
41

OPTIONS

43       Typing db.connect -p displays current connection parameters.
44

EXAMPLES

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

NOTES

113       To  connect  a  vector  map  to  a  database table, use v.db.connect or
114       v.db.addtable.
115

SEE ALSO

117        db.columns, db.drivers, db.login, db.tables, v.db.addtable,  v.db.con‐
118       nect, GRASS SQL interface
119

AUTHOR

121       Radim Blazek, ITC-Irst, Trento, Italy
122
123       Last changed: $Date: 2006/03/15 08:44:34 $
124
125       Full index
126
127
128
129GRASS 6.2.2                                                      db.connect(1)
Impressum