DBI/SQL backend

David Reiser dbreiser at earthlink.net
Sat Jun 21 23:00:49 EDT 2008

On Jun 16, 2008, at 6:58 PM, Phil Longstaff wrote:

> Nathan Buchanan wrote:
>> On Wed, Jun 11, 2008 at 8:58 PM, Phil Longstaff  
>> <plongstaff at rogers.com
>> <mailto:plongstaff at rogers.com>> wrote:
>>    I think the DBI/SQL backend is ready to try.  It is in the gda- 
>> dev2
>>    branch.  The GDA backend has been disabled and a DBI backend is  
>> enabled.
>>     It assumes that the include files are in /usr/include/dbi/dbi.h  
>> and the
>>    driver files are in /usr/lib/dbd.  The only driver that the DBI  
>> backend
>>    supports is sqlite3.  I am using libdbi-0.8.2.  I assume later  
>> versions
>>    will work.  I don't know about earlier versions.  There is a  
>> compilation
>>    check that the header file is present, but no version check.
>>    No new URI types have been added.  If you try to open a file, it  
>> will
>>    check if it is an sqlite3 file, and will load it with sqlite3.   
>> If it
>>    can't, it will revert to xml.  Save As will save a file as an  
>> sqlite3
>>    file.  The "Connect to Database" menu entry is still enabled but  
>> will
>>    (probably) fail.
>>    I don't have a windows compilation environment, so I haven't  
>> tried it on
>>    windows.
>> So, I got it compiled (with the gmtime fix) and it seems to run ok up
>> until I try to save as. When I choose save as and enter the desired  
>> file
>> name I get an error stating "Can't parse the URL
>> C:\soft\test_file\test.db." This happens with *all* names I enter,
>> including *.gnc names, so something is slightly broken ;) I suspect  
>> it's
>> that windows formatted name problem again, but can't spend time on it
>> for the next few days.
> The problem might also be that it can't find the sqlite3 dbd  
> driver.  On
> Linux, set environment var GNC_DBD_DIR to the library where the  
> drivers
> are (default /usr/lib/dbd).  If I set this to a directory which exists
> but has no drivers, I get the same symptoms that you do.  I've added a
> message to the trace log about the number of drivers found.  Warning
> level if no drivers, info level if drivers found.  Try adding
> --log=gnc.backend.dbi=info to the command line and see what the  
> backend
> says.
> Phil

I still have the problem with r17242.
Mac OS X 10.5.3, gcc 4.0.1, gnome is pieces of 2.18-2.22, libdbi 0.8.2

Early in the load sequence, I get:
* 22:38:19  INFO <gnc.backend.dbi> [gnc_dbi_check_sqlite_file] exists,  
does not have SQLite format string -> not DBI

later when I try the Save As, logging reports:
* 22:39:22  INFO <gnc.backend.dbi> [gnc_dbi_check_sqlite_file] doesn't  
exist (errno=2) -> DBI
* 22:39:22  INFO <gnc.backend.dbi> [gnc_dbi_backend_new] 1 DBD drivers  
* 22:39:22  CRIT <gnc.backend.dbi> [gnc_dbi_session_begin()] Unable to  
create sqlite3 dbi connection

Having GNC_DBD_DIR set or not does not affect the logging messages. I  
did configure with --with-dbi-dbd-dir=/sw/lib/dbd
The sqlite3 I want to use (version 3.4.2) is in /sw/bin. 'which  
sqlite3' responds /sw/bin/sqlite3. /usr/bin/sqlite3 (version 3.4.0)  
does exist and is used by other software.

My libdbi drivers are tied to the fink-installed sqlite3 (/sw/bin/ 

David Reiser
dbreiser at earthlink.net

More information about the gnucash-devel mailing list