[GRASSLIST:1053] Re: vector map <-> db connection

Massimiliano Cannata massimiliano.cannata at supsi.ch
Tue May 9 12:26:12 EDT 2006


Yes it is....
I just usually use "db.connect driver=dbf 
database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'" to set the connection 
and then "v.db.connect -o map=blabla table=blabla" to set the link...

you can also do not use db.connect and specify connection parameters 
with v.db.connect.

In fact:
db.connect - Set up connection to the database through DBMI.
v.db.connect - Sets DB connection for a vector map.
The first command let you set the DB connection that GRASS is currently 
using, the second one set the link between the geometry file (native 
grass format) and an attribute file (db table).
If a DB connection is set (trough db.connect) it is used as default and 
no more additional parameters (driver & database) are needed.
Otherwise you have to specify the connection parameters: driver=dbf 
database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'

Just try:
db.connect -p (to see your default connection setting)
db.tables -p (to see a list of the avilable tables)

just to check evrything is fine.... (you should be able to see you table!)

Hope it could be helpful...
Max

Stefán István wrote:

>I ran v.db.connect. Isn't it the right command for a task like this?
>
>Istvan
>
>kedd 09 május 2006 17.39 dátummal ezt írta:
>  
>
>>did you run db.connct?
>>do you have the correct permission on the dbf file?
>>hello,
>>max
>>
>>Stefán István wrote:
>>
>>    
>>
>>>Hello List!
>>>
>>>I have problem connecting a vector map to a database.
>>>I created a vectormap by the v.digit command, and then I would like to add 
>>>some information to the digitialized points.
>>>
>>>I created a db connection with this command:
>>>GRASS 6.1.cvs (Ferencvaros):~ > v.db.connect -o map=kietmelo_kutak_1 
>>>driver=dbf table=kutak1
>>>WARNING: Table <kutak1> does not exist in database
>>>        <$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/>
>>>WARNING: The table <kutak1> is now part of vector map <kietmelo_kutak_1>
>>>        and may be deleted or overwritten by GRASS modules.
>>>
>>>Then I tried to add columns, but I got error message:
>>>GRASS 6.1.cvs (Ferencvaros):~ > v.db.addcol map=kietmelo_kutak_1 
>>>      
>>>
>columns="nev 
>  
>
>>>varchar(10)"
>>>DBMI-DBF driver error:
>>>Table 'kutak1' doesn't exist.
>>>Error in db_execute_immediate()
>>>
>>>ERROR: Error while executing: "ALTER TABLE kutak1 ADD COLUMN nev
>>>      varchar(10)
>>>      "
>>>ERROR: Cannot continue (problem to add column).
>>>
>>>
>>>What did I wrong?
>>>
>>>Thanks for the help in advance,
>>>Istvan
>>>
>>>
>>>
>>> 
>>>
>>>      
>>>
>>-- 
>>
>>Eng. Massimiliano Cannata
>>Scuola Universitaria Professionale della Svizzera Italiana
>>Istituto Scienze della Terra
>>Via Trevano, c.p. 72
>>CH-6952 Canobbio-Lugano
>>Tel: +41 (0)58 666 62 14
>>Fax +41 (0)58 666 62 09
>>
>>
>>    
>>
>
>
>  
>


-- 

Eng. Massimiliano Cannata
Scuola Universitaria Professionale della Svizzera Italiana
Istituto Scienze della Terra
Via Trevano, c.p. 72
CH-6952 Canobbio-Lugano
Tel: +41 (0)58 666 62 14
Fax +41 (0)58 666 62 09




More information about the grass-user mailing list