.TH db.connect 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBdb.connect\fR\fR - Prints/sets general DB connection for current mapset and exits. .SH KEYWORDS database, attribute table, connection settings .SH SYNOPSIS \fBdb.connect\fR .br \fBdb.connect help\fR .br \fBdb.connect\fR [\-\fBpc\fR] [\fBdriver\fR=\fIname\fR] [\fBdatabase\fR=\fIname\fR] [\fBschema\fR=\fIstring\fR] [\fBgroup\fR=\fIstring\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-p\fR" 4m .br Print current connection parameters and exit .IP "\fB\-c\fR" 4m .br Check connection parameters, set if uninitialized, and exit .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBdriver\fR=\fIname\fR" 4m .br Driver name .br Options: \fIpg,dbf,ogr,odbc,mysql,sqlite\fR .br Default: \fIdbf\fR .IP "\fBdatabase\fR=\fIname\fR" 4m .br Database name .br Default: \fI$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\fR .IP "\fBschema\fR=\fIstring\fR" 4m .br Database schema .br Do not use this option if schemas are not supported by driver/database server .IP "\fBgroup\fR=\fIstring\fR" 4m .br Default group of database users to which select privilege is granted .PP .SH DESCRIPTION \fIdb.connect\fR allows the user to set database connection parameters. These parameters are then taken as default values by modules so that the user does not need to enter the parameters each time. .PP The default database backend in GRASS 6 is DBF. .SH NOTES Values are stored in the mapset's VAR file; the connection is not tested for validity. .PP The \fB-p\fR flag will display the current connection parameters. .PP The \fB-c\fR flag will silently check if the connection parameters have been set, and if not will set them to use GRASS's default values. (useful in scripts before you attempt to create a new database table) .PP To connect a vector map to a database table, use \fIv.db.connect\fR or \fIv.db.addtable\fR. .SH EXAMPLES .SS DBF Local storage (the dbf/ subdirectory in the mapset must exist or must be created by the user): .br \fC .DS .br db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' .br db.tables \-p .br .DE \fR .SS SQLite Local storage: .br \fC .DS .br db.connect driver=sqlite database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db' .br db.connect \-p .br db.tables \-p .br .DE \fR .PP The SQLite database file is created automatically when used the first time. .SS ODBC Network storage, database tables stored in database "mydb" (may require the use of \fIdb.login\fR): .br \fC .DS .br db.connect driver=odbc database=mydb .br db.login user=myname [pass=secret] .br db.connect \-p .br db.tables \-p .br .DE \fR .SS PostgreSQL Network storage, database tables stored in database "mydb" (may require the use of \fIdb.login\fR): .br \fC .DS .br db.connect driver=pg database="host=myserver.itc.it,dbname=mydb" .br db.login user=myname [pass=secret] .br db.connect \-p .br db.tables \-p .br .DE \fR .SS PostgreSQL with different port Network storage, database tables stored in database "mydb" (may require the use of \fIdb.login\fR): .br \fC .DS .br db.connect driver=pg database="host=myserver.itc.it,dbname=mydb,port=6666" .br db.login user=myname [pass=secret] .br db.connect \-p .br db.tables \-p .br .DE \fR .SS MySQL (local) Local storage (\fIdb.login\fR may not be needed): .br \fC .DS .br db.connect driver=mysql database=mydb .br db.login user=myname [pass=secret] .br db.connect \-p .br db.tables \-p .br .DE \fR .SS MySQL (external server) Network storage, database tables stored in database "mydb" (may require the use of \fIdb.login\fR): .br \fC .DS .br db.connect driver=mysql database="host=myserver.itc.it,dbname=mydb" .br db.login user=myname [pass=secret] .br db.connect \-p .br db.tables \-p .br .DE \fR .SH SEE ALSO \fI db.columns, db.copy, db.drivers, db.login, db.tables, v.db.addtable, v.db.connect \fR .PP GRASS SQL interface .SH AUTHOR Radim Blazek, ITC-Irst, Trento, Italy .PP \fILast changed: $Date: 2013-12-14 23:40:25 +0100 (Sat, 14 Dec 2013) $\fR .PP Full index .PP © 2003-2014 GRASS Development Team