I am working with SQLite code I have developed in .NET 2.0
I have done this development in .NET 2.0 because one of the
installation locations for the database client runs
Windows 2000, controlling a large machine (a beam saw).
The saw was shipped with a computer running Windows 2000,
and has never been upgraded the vendor of the machine. Thus
my .NET code must be able to run on Windows 2000, and since
Windows 2000 supports .NET only up to 2.0, with .NET 2.0.
I've done all my development with .NET 4.0 on a 64-bit
system, but the targeting of the code has been for x64.
I have set the project to use .Net 2.0. I am using
the .Net 2.0 version of the System.Data.SQLite.DLL.
I have demo'd the program to the client w/o my development
system, using an x64 laptop, w/Win7 & .Net 4.0. No problems
The program will run on the following machines at the
client site:
3 each Win 7 32-bit w .Net 4.0
1 each Win2000 32-bit w .Net 2.0
Today I installed the application on one of my client's
computers for the first time (a Win 7 23-bit with
.Net 4.0) in preparation for a complete installation on
all machine.
I installed the following files
// My DLL of application specific stuff
08/26/2014 09:00 PM 59,904 Cut85Db.dll
// The GUI and application rules
08/27/2014 09:46 AM 386,048 Cut85Inventory.exe
// The config file shown below
07/27/2014 04:45 PM 2,014 Cut85Inventory.exe.config
// The interop DLL
07/27/2014 04:47 PM 843,776 SQLite.Interop.dll
// A helper DLL for SQLite
08/26/2014 09:00 PM 12,288 SQLiteDb.dll
// The main SQLite DLL
06/23/2014 09:56 AM 282,624 System.Data.SQLite.dll
// I don't use LINQ in .NET 2.0, so I don't think I need this
// but it's there
03/19/2014 01:54 PM 183,808 System.Data.SQLite.Linq.dll
// Files created by my installer
08/27/2014 11:36 AM 28,627 unins000.dat
08/27/2014 11:35 AM 1,178,825 unins000.exe
The database itself is located in the C:\USERS\PUBLIC
directory of the machine I installed on.
When I ran the application, it ran, and, per design, when not
finding a configured database, provided a dialog to the user
to select the database file. Then it proceed to run until it
returned the following error:
ERROR ---------------
Timestamp: 2014-09-23T13:13:10.9914213
System.Data.SQLite.SQLiteException: unable to open database file
System.ApplicationException: Error in SQLiteDb.LDb3.PrepareCommand.
System.ApplicationException: Error in SQLiteDb.LDb3.GetDataTable.
System.ApplicationException: Error in
Cut85Db.Composition.GetFirstFieldResults.
System.ApplicationException: Error in
Cut85Db.Composition.GetInventoryCoreMaterials.
System.ApplicationException: Error in
Cut85Db.Composition.GetInventoryCoreMaterialsIT.
System.ApplicationException: Error in
Cut85Inventory.Rules.FilterInterface_Construct.
---------------------
This is a single exception that has the bubbled back to the
caller.
Reading in order, it says that:
SQLiteDb.LDb3.PrepareCommand threw an exception with the message
'unable to open database file'
it was caught by SQLiteDb.LDb3.PrepareCommand
then caught by Cut85Db.Composition.GetFirstFieldResults
the caught by Cut85Db.Composition.GetInventoryCoreMaterials
then caught by Cut85Db.Composition.GetInventoryCoreMaterialsIT
the caught by Cut85Inventory.Rules.FilterInterface_Construct
When the application starts, I call
var DB = new LDb3(Properties.Settings.Default.DBPath);
This creates my LDb3 (Lite Database sql3 helper) with the
current database path.
In FilterInterface_Construct I call GetInventoryCoreMaterialsIT(DB)
GetInventoryCoreMaterialsIT (with the IT suffix) means it
Gets a list of CoreMaterial names with an internally transacted
method called GetInventoryCoreMaterials. This prepares a query
to return the unique set of CoreMaterials known to the database
(a column in a table called Compositions). Since the query only
returns one column in a DataTable, I call GetFirstFieldResults
with the query.
So I can get a connection from my LDB3 helper object, I can
use the connection to get create a command. In the process of
getting a DataTable from the query, I call a method PrepareCommand,
which looks like this:
private void PrepareCommand(SQLiteCommand command, string sql)
{
var errorLocus = GetErrorLocus();
try
{
if (command.Connection.State == ConnectionState.Closed)
command.Connection.Open(); // <-Exception thrown here
// with message
// 'unable to open database file'
if (command.Connection.State != ConnectionState.Open)
throw new ApplicationException("Connection could not be
opened.");
command.Parameters.Clear();
command.CommandText = sql;
}
catch (Exception ex) { throw new ApplicationException(errorLocus,
ex); }
}
So it seems that all the SQLite logic up to the point where I attempt to
open the database connection is working, but SQLite cannot open the
connection to the database the user selected by providing the path.
I can open the very same database on the very same machine using SQLite
Expert personal.
What can be going wrong here?
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users