man v.db.connect () - prints/sets DB connection for a vector map

NAME

v.db.connect - prints/sets DB connection for a vector map

SYNOPSIS

v.db.connect

v.db.connect help

v.db.connect [-pgcod] map=string [driver=string] [database=string] [table=string] [key=string] [layer=integer]

Flags:

"-p
print current connection parameters and exit
"-g
print current connection parameters (shell script style) layer[/layer name] table key database driver
"-c
print types/names of table columns for specified layer and exit
"-o
overwrite connection parameter for certain layer
"-d
Delete connection for certain layer (not the table)

Parameters:

"map=string
Name of input vector
"driver=string
driver name: Options: dbf,odbc,pg,mysql,ogr
"database=string
database name:
"table=string
table name
"key=string
key name (integer column): Default: cat
"layer=integer
Layer number Default: 1

DESCRIPTION

v.db.connect prints or sets database connection for a vector map.

NOTE

If parameters for database connection are already set with db.connect, they are taken as default values and do not need to be spcified each time.

Attention: Removing a vector map will also delete all tables linked to it! If you use v.db.connect to link further tables to your map, it is advisable to make a copy from those tables first and connect the copied tables to the vector map (see also v.overlay).

EXAMPLE

Print database connection

v.db.connect -p map=vectormap

Print column types and names of table linked to vector map

v.db.connect -c map=vectormap

Connect vector map to database (DBF driver)

v.db.connect map=vectormap table=table layer=1 key=cat driver=dbf database=/daten/grassdata/fire/PERMANENT/dbf

Connect vector map to database with variables

(note: single quotes must be used)

v.db.connect map=vectormap table=table layer=1 key=cat driver=dbf database='$GISDBASE/$LOCATION_NAME/PERMANENT/dbf'

Connect vector map to database with variables

(note: single quotes must be used)

v.db.connect map=vectormap table=table layer=1 key=cat driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf'

Connect vector map to database (PostgreSQL driver)

db.describe -c map=vectormap

v.db.connect map=vectormap table=table layer=1 key=oid driver=pg database="host=myserver.itc.it,dbname=mydb,user=name" table=mytable key=id

SEE ALSO

db.connect

db.copy

v.overlay

AUTHOR

Radim Blazek, ITC-Irst, Trento, Italy

Last changed: $Date: 2005/06/21 19:21:58 $

Help Index