<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=windows-1255"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body bidimailui-charset-is-forced="true"
    bidimailui-detected-decoding-type="preferred-charset" text="#000000"
    bgcolor="#ffffff">
    On 05/08/2011 01:28 AM, <a class="moz-txt-link-abbreviated" href="mailto:rvanderweide@worldbank.org">rvanderweide@worldbank.org</a> wrote:
    <blockquote
cite="mid:OF5E027084.6FFF88FB-ON85257889.007B6EDE-85257889.007B6EE8@worldbank.org"
      type="cite"><font face="Default Sans
        Serif,Verdana,Arial,Helvetica,sans-serif" size="2">
        <p style="margin: 0px;">Dear GRASS users,</p>
        <p style="margin: 0px;"> </p>
        <p style="margin: 0px;">I keep on getting SQLite driver errors
          when trying to use a newly created SQLite database ('unable to
          open database'). By default, GRASS starts up connected to DBF.
          Connecting to an SQLite database works fine (when the database
          does not yet exist, it seems to create an empty database).</p>
      </font></blockquote>
    <p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
    </p>
    <p style="margin-bottom: 0cm; margin-top: 0pt;">No I think that no
      database is created. It seems you have to do that manually, then
      the import and copy will work:</p>
    <p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
    </p>
    <p style="margin-bottom: 0cm; margin-top: 0pt;"><tt>GRASS 6.4.0
        (UTM36):~ &gt; db.connect -p<br>
        driver:dbf<br>
        database:$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/<br>
        schema:<br>
        group:<br>
        GRASS 6.4.0 (UTM36):~ &gt; eval `g.gisenv`<br>
        GRASS 6.4.0 (UTM36):~ &gt; db.connect driv=sqlite
        database=$GISDBASE/$LOCATION_NAME/$MAPSET/geodata.db<br>
        GRASS 6.4.0 (UTM36):~ &gt; db.connect -p<br>
        driver:sqlite<br>
        database:/home/micha/geodata/grass/UTM36/Israel/geodata.db<br>
        schema:<br>
        group:<br>
        <br>
        GRASS 6.4.0 (UTM36):~ &gt; ll
        /home/micha/geodata/grass/UTM36/Israel/geodata.db<br>
        ls: cannot access
        /home/micha/geodata/grass/UTM36/Israel/geodata.db: No such file
        or directory</tt></p>
    <p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
    </p>
    <p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
    </p>
    <p style="margin-bottom: 0cm; margin-top: 0pt;">Note that no
      sqlite.db exists yet, so I do:</p>
    <p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
    </p>
    <p style="margin-bottom: 0cm; margin-top: 0pt;"><tt>GRASS 6.4.0
        (UTM36):~ &gt; sqlite3
        /home/micha/geodata/grass/UTM36/Israel/geodata.db<br>
        SQLite version 3.6.22<br>
        Enter ".help" for instructions<br>
        Enter SQL statements terminated with a ";"<br>
        sqlite&gt; create table temp (label varchar(16));<br>
        sqlite&gt; .quit<br>
        GRASS 6.4.0 (UTM36):~ &gt; ll
        /home/micha/geodata/grass/UTM36/Israel/geodata.db<br>
        -rw-r--r-- 1 micha micha 2048 2011-05-08 07:48
        /home/micha/geodata/grass/UTM36/Israel/geodata.db</tt><br>
      <br>
    </p>
    <p style="margin-bottom: 0cm; margin-top: 0pt;">A minor annoyance, I
      guess. But if you think of sqlite as a database like PostgreSQL
      you wouldn't expect GRASS to create a PostgreSQL database
      automatically ...</p>
    <p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
    </p>
    <p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
    </p>
    <blockquote
cite="mid:OF5E027084.6FFF88FB-ON85257889.007B6EDE-85257889.007B6EE8@worldbank.org"
      type="cite"><font face="Default Sans
        Serif,Verdana,Arial,Helvetica,sans-serif" size="2">
        <p style="margin: 0px;">So far so good. Problems emerge however
          when i next wish to import a shapefile, OR copy an attribute
          table from a shapefile that was previously imported using the
          DBF driver. I recall that an earlier version of GRASS 6.4 used
          SQLite as the default driver. With this version, all worked
          well, i.e. i did NOT have the problems described below.</p>
        <p style="margin: 0px;"> </p>
        <p style="margin: 0px;">Let me attach the command lines for both
          examples:</p>
        <p style="margin: 0px;"> </p>
        <p style="margin: 0px;">(1) Problem importing shapefile while
          connected to a SQLite database:</p>
        <p style="margin: 0px;"> </p>
        <p style="margin: 0px;">GRASS 6.4&gt; db.connect driver=sqlite
          database="c:\Test\sqlite.db"<br>
          GRASS 6.4&gt; v.in.ogr dsn=C:\Test\pse.shp layer=pse
          output=pse                               <br>
          Datum &lt;Palestine_1923&gt; not recognised by GRASS and no
          parameters found<br>
          Projection of input dataset and current location appear to
          match<br>
          Layer: pse<br>
          DBMI-SQLite driver error:<br>
          Unable to open database: unable to open database file<br>
          Unable to open database &lt;c:\test\sqlite.db&gt; by driver
          &lt;sqlite&gt;<br>
          ERROR: Unable open database &lt;c:\test\sqlite.db&gt; by
          driver &lt;sqlite&gt;<br>
          (Fri May 06 13:33:01 2011) Command finished (0 sec)</p>
        <p style="margin: 0px;"> </p>
        <p style="margin: 0px;">(2) Problem copying attribute table
          (imported in DBF) to SQLite database):</p>
        <p style="margin: 0px;"> </p>
        <p style="margin: 0px;">GRASS 6.4&gt; db.connect driver=sqlite
          database="c:\Test\sqlite.db"<br>
          GRASS 6.4&gt; g.copy <a moz-do-not-send="true"
            href="mailto:vect=pse@pov4,pse_sqlite" target="blank">vect=pse@pov4,pse_sqlite</a><br>
          Copy vector &lt;<a moz-do-not-send="true"
            href="mailto:pse@pov4" target="blank">pse@pov4</a>&gt; to
          current mapset as &lt;pse_sqlite&gt;<br>
          DBMI-SQLite driver error:<br>
          Unable to open database: unable to open database file</p>
        <p style="margin: 0px;">WARNING: Unable to open database
          &lt;sqlite&gt; by driver &lt;c:\Test\sqlite.db&gt;<br>
          no database is open<br>
          WARNING: Unable to copy table &lt;pse_sqlite&gt;<br>
          WARNING: Cannot copy &lt;<a moz-do-not-send="true"
            href="mailto:pse@pov4" target="blank">pse@pov4</a>&gt; to
          current mapset as &lt;pse_sqlite&gt;</p>
        <p style="margin: 0px;"> </p>
        <p style="margin: 0px;"> </p>
        <p style="margin: 0px;">(*) What am i doing wrong -- What is the
          easiest way of fixing both of these problems??</p>
        <p style="margin: 0px;"> </p>
        <p style="margin: 0px;"> </p>
        <p style="margin: 0px;">Many thanks in advance,</p>
        <p style="margin: 0px;"> </p>
        <p style="margin: 0px;">Roy</p>
      </font><br>
      This mail was received via Mail-SeCure System.<br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/grass-user">http://lists.osgeo.org/mailman/listinfo/grass-user</a>

This mail was received via Mail-SeCure System.


</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Micha Silver
Arava Development Co. +972-52-3665918
<a class="moz-txt-link-freetext" href="http://www.surfaces.co.il">http://www.surfaces.co.il</a>
 
</pre>
  </body>
</html>