db.connect

Langue: en

Autres versions - même langue

Version: 148720 (fedora - 04/07/09)

Section: 1 (Commandes utilisateur)

NAME

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

KEYWORDS

database, SQL

SYNOPSIS

db.connect
db.connect help
db.connect [-p] [driver=name] [database=name] [schema=string] [group=string] [--verbose] [--quiet]

Flags:

-p

Print current connection parameters and exit
--verbose

Verbose module output
--quiet

Quiet module output

Parameters:

driver=name

Driver name
Options: odbc,pg,dbf
Default: dbf
database=name

Database name
Default: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
schema=string

Database schema
Do not use this option if schemas are not supported by driver/database server
group=string

Default group of database users to which select privilege is granted

DESCRIPTION

db.connect allows the user to set parameters for connection to database. These parameters are then taken by modules as default values and user do not need enter parameters each time. Values are stored in user file; the connection is not tested for validity.

OPTIONS

Typing db.connect -p displays current connection parameters.

EXAMPLES

DBF

Local storage (the dbf/ subdirectory in the mapset must exist or must be created by the user):

db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
db.tables -p

SQLite

Local storage:

db.connect driver=sqlite database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db'
db.connect -p
db.tables -p

The SQLite database is created automatically when used the first time.

ODBC

Network storage: (may require the use of db.login):

 
db.connect driver=odbc database=gtest
db.login user=myname [pass=secret]
db.connect -p
db.tables -p

PostgreSQL

Network storage: (may require the use of db.login):

db.connect driver=pg database="host=myserver.itc.it,dbname=mydb"
db.login user=myname [pass=secret]
db.connect -p
db.tables -p

PostgreSQL with different port

Network storage: (may require the use of db.login):

db.connect driver=pg database="host=myserver.itc.it,dbname=mydb,port=6666"
db.login user=myname [pass=secret]
db.connect -p
db.tables -p

MySQL (local)

Local storage (db.login may not be needed):

db.connect driver=mysql database=mydb
db.login user=myname [pass=secret]
db.connect -p
db.tables -p

MySQL (external server)

Network storage: (may require the use of db.login):

db.connect driver=mysql database="host=myserver.itc.it,dbname=mydb"
db.login user=myname [pass=secret]
db.connect -p
db.tables -p

NOTES

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

SEE ALSO

db.columns, db.drivers, db.login, db.tables, v.db.addtable, v.db.connect, GRASS SQL interface

AUTHOR

Radim Blazek, ITC-Irst, Trento, Italy

Last changed: $Date: 2007-01-27 21:08:32 +0100 (Sat, 27 Jan 2007) $

Full index

Š 2003-2008 GRASS Development Team