ArcGIS Engine: Can a Query Layer be created from a SQLite database in 10.2?

Discussion created by skutz on Oct 12, 2013
Latest reply on Oct 25, 2013 by skutz
Is it possible to use a SQLite database as the basis for creating a Query Layer in an ArcGIS Engine application starting with ArcGIS 10.2?

The ArcGIS 10.2 Help on Query Layers has been updated to specify the use of the Teradata databases (newly-supported in ArcGIS 10.2).

Other portions of ArcGIS 10.2 Help mention SQLite, but the Query Layers documentation is notably silent on SQLite.

The code fragment below shows an example of what would seem to be a potential approach (based on an existing method for creating a Query Layer against other database types).

But I have not been able to locate any documentation on how to populate the PropertySet to establish a connection to a SQLite database.

// Code fragment for creating a feature layer for a Query Layer in ArcGIS Engine.
// Environment: Visual C++, MFC, Visual Studio 2010
IWorkspaceFactory2Ptr       pWorkspaceFactory2 = NULL; 
IWorkspacePtr               pWorkspace = NULL;
ISqlWorkspacePtr            pSqlWorkspace = NULL;
IQueryDescriptionPtr        pQueryDescription = NULL;
ITablePtr                   pTableForSQL = NULL;
IFeatureClassPtr            pFeatureClassForSQL = NULL;
IFeatureLayerPtr            pFeatureLayer = NULL;

IPropertySetPtr             pPropertySet = NULL;
OLE_HANDLE                  hWnd = 0;
HRESULT                     hr = S_OK;

// Note: All error handling removed from the sample code.


// ... Q: How to populate the PropertySet appropriately for a SQLite database(?)
//  Once the Property Set is populated, open the workspace.
hr = pWorkspaceFactory2->Open(pPropertySet, hWnd, &pWorkspace); 

// QI to get the ISqlWorkspace interface pointer
pSqlWorkspace = pWorkspace;

// Pass the incoming SQL query text on to ArcGIS Engine Runtime so it can make its
// attempt to create the Query Description object.
hr = pSqlWorkspace->GetQueryDescription(CComBSTR(_T("SELECT * FROM BASEDB.DISTRIBUTIONMAIN")),

// Attempt to open the Query Class for the Query Layer by passing in the
// (possibly modified) Query Description object.
hr = pSqlWorkspace->OpenQueryClass(CComBSTR(_T("Distr_Mains")), 

// QI to determine if the query class also supports the IFeatureClass interface.
// If so, this indicates it is able to form the basis for a Feature Layer.
pFeatureClassForSQL = pTableForSQL;

if (pFeatureClassForSQL != NULL)
   // Create the new feature layer object

   // Assign the just-created feature class to the layer
   hr = pFeatureLayer->putref_FeatureClass(pFeatureClassForSQL);

   // ... additional logic to assign layer properties ...

Any insights would be appreciated.

Thanks for your help.