Unable to open database file

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Cloud Applications
Post Reply
brucecallen
Posts: 6
Joined: Tue 17 Feb 2015 20:31

Unable to open database file

Post by brucecallen » Thu 19 Feb 2015 18:00

I am getting an error on our production server when opening a connection to SalesForce. This is deployed as a web application and is running as Fully Trusted. This is working in development. I am using the most recent 2.4.573.6. I have tried both the 32 bit and 64 bit sqllite3.dll

This is the error:
The underlying provider failed on Open. - Line(46):Application_Error():
Unable to open the database file - Line(43):InnerException at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
This is my web.config:

Code: Select all

  <connectionStrings>
	  <add name="SalesForceConnection"  connectionString="metadata=res://*/SalesForceDataModel.csdl|res://*/SalesForceDataModel.ssdl|res://*/SalesForceDataModel.msl;provider=Devart.Data.Salesforce;provider connection string="User Id=xxxxxx;Password=yyyyyy;Security Token=zzzzzzzzzzzz;Client Id=AFG.Admin;Persist Security Info=True;Host=login.salesforce.com"" providerName="System.Data.EntityClient" />
<!-- tried this also <add name="SalesForceConnection" connectionString="metadata=res://AFG.Data.SalesForce/SalesForceDataModel.csdl|res://AFG.Data.SalesForce/SalesForceDataModel.ssdl|res://AFG.Data.SalesForce/SalesForceDataModel.msl;provider=Devart.Data.Salesforce;provider connection string="User Id=xxxxxxx;Password=yyyyyyyyy;Security Token=zzzzzzzzzzzzzz;Client Id=AFG.Admin;Persist Security Info=True;Host=login.salesforce.com"" providerName="System.Data.EntityClient" />-->
	
  </connectionStrings>

  <entityFramework>
	<providers>
	  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
	  <provider invariantName="Devart.Data.Salesforce" type="Devart.Data.Salesforce.Entity.SalesforceEntityProviderServices, Devart.Data.Salesforce.Entity, Version=2.4.573.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </providers>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <interceptors>
    </interceptors>
  </entityFramework>

	<system.data>
		<DbProviderFactories>
			<remove invariant="Devart.Data.Salesforce" />
			<add name="dotConnect for Salesforce" invariant="Devart.Data.Salesforce" description="Devart dotConnect for Salesforce" type="Devart.Data.Salesforce.SalesforceProviderFactory, Devart.Data.Salesforce, Version=2.4.573.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
		</DbProviderFactories>
	</system.data>


Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Unable to open database file

Post by Shalex » Fri 20 Feb 2015 10:37


brucecallen
Posts: 6
Joined: Tue 17 Feb 2015 20:31

Re: Unable to open database file

Post by brucecallen » Fri 20 Feb 2015 16:07

Thank you that solved the problem. It took me a while to figure out where the data cache goes. Here it is for the next person:

Code: Select all

connectionString="metadata=res://*/SalesForceDataModel.csdl
				|res://*/SalesForceDataModel.ssdl
				|res://*/SalesForceDataModel.msl;
				provider=Devart.Data.Salesforce;
				provider connection string="User Id=xxxxxxxx;Password=yyyyyyy;Security Token=zzzzzzzzzzzzzz;Client Id=AFG.Admin;Persist Security Info=True;Host=login.salesforce.com;Data Cache=d:/web/admin/appdata/1.db;Metadata Cache=d:/web/admin/appdata/1_metadata.db;"" 
		   providerName="System.Data.EntityClient" />
Make sure you give IIS_USRS permissions for the folder where your cache database is located.

Also do not be cute and try and split up the connection string line into multiple lines to make it more readable. The parser doesn't understand this.

Post Reply