[GRASSLIST:731] Re: Grass 6.1.cvs/MySQL - how?

David Adam david at quercus.org
Mon Apr 17 22:46:25 EDT 2006


Dylan Beaudette wrote:

> David,
>
> The GRASS wiki contains some information on this. I have also 
> documented my procedures here:
>
> http://casoilresource.lawr.ucdavis.edu/drupal/node/129
>
> Cheers,
>
> Dylan
>
> On Apr 16, 2006, at 5:26 PM, David Adam wrote:
>
>> I'm confused as to how to use MySQL 4.0.16 with Grass 6.1.cvs on a
>> Fedora Core 4 system.  I'll start with what seems pretty basic: the 
>> "test database" choice
>> in the GUI interface.  The results I get are shown here:
>>
>> db.test test=test1
>> create table grass_test1 (i1 integer, d1 double precision, c1 
>> varchar(20))
>> EXECUTE: OK
>> insert into grass_test1 values ( 1, 123.456, 'abcd' )
>> EXECUTE: OK
>> insert into grass_test1 values ( 2, null, 'xxx' )
>> EXECUTE: OK
>> select * from grass_test1
>> dbmi: Protocol error
>> EXECUTE: ******** ERROR ********
>> 0a1,2
>> > 1|123.456000|abcd
>> > 2||xxx
>> RESULT: ******** ERROR ********
>> select c1 from grass_test1 where d1 < 500 / 2 and i1 <> 2  and c1 ~ 'bc'
>> dbmi: Protocol error
>> EXECUTE: ******** ERROR ********
>> 0a1
>> > abcd
>> RESULT: ******** ERROR ********
>> insert into grass_test1 values ( 3, 0.0, '_''_' )
>> EXECUTE: OK
>> alter table grass_test1 add column i2 integer
>> EXECUTE: OK
>> update grass_test1 set d1 = 18.6, i2 = 987  where i1 = 2
>> EXECUTE: OK
>> select * from grass_test1
>> dbmi: Protocol error
>> EXECUTE: ******** ERROR ********
>> 0a1,3
>> > 1|123.456000|abcd|
>> > 2|18.600000|xxx|987
>> > 3|0.000000|_'_|
>> RESULT: ******** ERROR ********
>> drop table grass_test1
>> EXECUTE: OK
>>
>> It looks like the driver and mysql are doing something, but returning 
>> errors.
>> This is undoubtedly a sign that I have missed something, but what?
>>
>> I'm also confused about where the mysql data are stored.  The 
>> documentation for
>> grass suggests that all data are stored in a primary directory 
>> (/gis/data in my case),
>> and I am able to work with both raster and vector layers stored 
>> there.  But mysql
>> has its own special data area (/var/lib/mysql in my case).
>> In order to use db.connect to hook up to mysql, the database must 
>> first exist (with proper
>> access permissions), so I have created a mysql database using mysql 
>> and then tried to
>> connect to it using db.connect, without apparent success.
>> I am assuming that if I import a vector file that includes both 
>> vectors and attributes, grass
>> should automatically create an attribute table to match the vectors, 
>> populating it with data
>> and linking it to the vector file as part of the importing process.  
>> Is this correct, or is there
>> something else I need to do?
>>
>> I have read through all of the documentation I could get ahold of, 
>> but have not been able
>> to get the system to work.  Any help would be most appreciated...
>>
>> david adam
>>
>>
> -- 
> Dylan Beaudette
> Soils and Biogeochemistry Graduate Group
> University of California at Davis
> 530.754.7341
>
>
Dylan,
Thanks for the reply.  I'm trying to use both those resources, but still 
have problems. 

In particular, why am I able to create the test table and write to it, 
but then get dbmi protocol
errors when the select is run?

Also, I suspect there may be an error in both your instructions and the 
wiki site, which have lines
that go like:

database=host=localhost,dbname=test

It seems likely to me that some enclosing single quotes are needed 
(probably after the first = and at the end of the line).

Again, thanks for the help.
 
david




More information about the grass-user mailing list