12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <h2>DESCRIPTION</h2>
- <em>db.copy</em> allows the user to copy a table between two databases.
- Databases can be connected through different drivers (see example).
- <h2>NOTES</h2>
- Attribute tables can be copied using <em>db.copy</em> and, when to be
- associated to a vector map, assigned to the map with
- <em><a href="v.db.connect.html">v.db.connect</a></em>. Current connection
- settings are saved in the file <em>$LOCATION/vector_map/dbln</em>.
- <h2>EXAMPLES</h2>
- <h3>DBF -> PG</h3>
- <em>Storing table 'geonames.dbf' (in current directory) into PostgreSQL
- through ODBC:</em><br>
- <div class="code"><pre>
- db.copy from_driver=dbf from_database='$GISDBASE/$LOCATION_NAME/PERMANENT/dbf' \
- from_table=geonames to_driver=pg to_database="host=pgserver,dbname=testdb" \
- to_table=geonames
- </pre></div>
- <h3>PG -> DBF</h3>
- <div class="code"><pre>
- db.copy from_driver=pg from_database="host=pgserver.example.org,dbname=testdb" \
- from_table=origtable to_driver=dbf \
- to_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf' to_table=origtable
- </pre></div>
- <h3>PG -> PG with condition</h3>
- <div class="code"><pre>
- db.copy from_driver=pg from_database="host=localhost,dbname=testdb" \
- from_table=geonames to_driver=pg to_database="host=localhost,dbname=testdb" \
- to_table=selection where="cat < 500"
- </pre></div>
- <h3>DBF -> SQLite</h3>
- <div class="code"><pre>
- db.copy from_driver=dbf from_database='$GISDBASE/$LOCATION_NAME/PERMANENT/dbf' \
- from_table=geonames_features to_driver=sqlite \
- to_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db' to_table=geonames_features
- # convenient viewer:
- sqlitebrowser $HOME/grassdata/nc_spm_08/user1/sqlite/sqlite.db
- </pre></div>
- <h3>SQLite -> DBF</h3>
- <div class="code"><pre>
- db.copy from_driver=sqlite from_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db' \
- from_table=ammprv to_driver=dbf to_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' \
- to_table=ammprv
- </pre></div>
- <h2>SEE ALSO</h2>
- <em>
- <a href="db.connect.html">db.connect</a>,
- <a href="db.drivers.html">db.drivers</a>,
- <a href="db.login.html">db.login</a>,
- <a href="v.db.connect.html">v.db.connect</a>,
- <a href="v.clean.html">v.clean</a>,
- <a href="sql.html">GRASS SQL interface</a>
- </em>
- <h2>AUTHOR</h2>
- Radim Blazek, ITC-irst, Trento, Italy
- <p><i>Last changed: $Date$</i>
|