123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <h2>DESCRIPTION</h2>
- <em>db.connect</em> 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.
- <p>
- The default database backend in GRASS GIS 7
- is <a href="grass-sqlite.html">SQLite</a>.
- <h2>NOTES</h2>
- Values are stored in the mapset's <tt>VAR</tt> file;
- the connection is not tested for validity.
- <p>The <b>-p</b> flag will display the current connection parameters.
- <p>The <b>-c</b> 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)
- <p>To connect a vector map to a database table,
- use <em><a href="v.db.connect.html">v.db.connect</a></em> or
- <em><a href="v.db.addtable.html">v.db.addtable</a></em>.
- <h2>EXAMPLES</h2>
- <h3>SQLite (default backend)</h3>
- Local storage:
- <br>
- <div class="code"><pre>
- db.connect -d
- db.connect -p
- db.tables -p
- </pre></div>
- <p>The SQLite database file is created automatically when used the first time.
- <p>See <a href="grass-sqlite.html">SQLite</a> database driver for details.
- <h3>PostgreSQL (local connection)</h3>
- Local storage, database tables stored in database "mydb"
- (may require the use of <em><a href=db.login.html>db.login</a></em>):
- <br>
- <div class="code"><pre>
- db.connect driver=pg database=mydb
- db.login user=myname pass=secret
- db.connect -p
- db.tables -p
- </pre></div>
- <p>See <a href="grass-pg.html">PostgreSQL</a> database driver for details.
- <h3>PostgreSQL (network connection)</h3>
- Network storage, database tables stored in database "mydb"
- (may require the use of <em><a href=db.login.html>db.login</a></em>):
- <br>
- <div class="code"><pre>
- db.connect driver=pg database=mydb
- db.login user=myname pass=secret host=myserver.com port=6666
- db.connect -p
- db.tables -p
- </pre></div>
- <p>See <a href="grass-pg.html">PostgreSQL</a> database driver for details.
- <h3>MySQL (local connection)</h3>
- Local storage, database tables stored in database "mydb" (may require
- the use of <em><a href=db.login.html>db.login</a></em>):
- <br>
- <div class="code"><pre>
- db.connect driver=mysql database=mydb
- db.login user=myname pass=secret
- db.connect -p
- db.tables -p
- </pre></div>
- <p>See <a href="grass-mysql.html">MySQL</a> database driver for details.
- <h3>MySQL (network connection)</h3>
- Network storage, database tables stored in database "mydb"
- (may require the use of <em><a href=db.login.html>db.login</a></em>):
- <br>
- <div class="code"><pre>
- db.connect driver=mysql database=mydb
- db.login user=myname pass=secret host=myserver.com
- db.connect -p
- db.tables -p
- </pre></div>
- <p>See <a href="grass-mysql.html">MySQL</a> database driver for details.
-
- <h3>ODBC</h3>
- Network storage, database tables stored in database "mydb"
- (may require the use of <em><a href=db.login.html>db.login</a></em>):
- <br>
- <div class="code"><pre>
- db.connect driver=odbc database=mydb
- db.login user=myname pass=secret
- db.connect -p
- db.tables -p
- </pre></div>
- <p>See <a href="grass-odbc.html">ODBC</a> database driver for details.
- <h3>DBF (local, not recommended)</h3>
- Local storage (the dbf/ subdirectory in the mapset must exist or must be
- created by the user):
- <br>
- <div class="code"><pre>
- db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
- db.tables -p
- </pre></div>
- <p>See <a href="grass-dbf.html">DBF</a> database driver for details.
-
- <h2>SEE ALSO</h2>
- <em>
- <a href="db.columns.html">db.columns</a>,
- <a href="db.copy.html">db.copy</a>,
- <a href="db.drivers.html">db.drivers</a>,
- <a href="db.login.html">db.login</a>,
- <a href="db.tables.html">db.tables</a>,
- <a href="v.db.addtable.html">v.db.addtable</a>,
- <a href="v.db.connect.html">v.db.connect</a>
- </em>
- <p>
- <a href="sql.html">GRASS SQL interface</a>
- <h2>AUTHORS</h2>
- Main author: Radim Blazek, ITC-Irst, Trento, Italy<br>
- GRASS 7 improvements: Martin Landa, Markus Metz
- <p>
- <i>Last changed: $Date$</i>
|