问题
I am getting the following error trying to connect to DB2 Entity with .Net 4.0
The underlying provider failed on ConnectionString.
I get it on this line within the generated code of my entity cs file
public DOCUMAKRContainer() : base("name=DOCUMAKRContainer", "DOCUMAKRContainer")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
My App.config (which is created when you create entity the looks like this
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections />
<connectionStrings>
<add name="DOCUMAKRContainer"
connectionString="metadata=res://*/Documakr.csdl|res://*/Documakr.ssdl|res://*/Documakr.msl;provider=IBM.Data.DB2;provider connection string="Database=DCCPDEVL;User ID=documakr;Password=Dcpd@123;server.com:60000"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
I have tried to delete and rebuild the entity and get the same results every time. All of this is generated code when you add an entity object, so I am wondering if it is a VS 2010/IBM DB2 issue. Internet has not really given me any help.
Thoughts?
回答1:
This site is a good resource: http://www.connectionstrings.com/
It looks you have have some garbage in your connection string:
provider connection string="Database
Actually, it looks like you've got a conection string jammed into your connection string.
Also, you might want to edit your post and remove or ##### the login info.
来源:https://stackoverflow.com/questions/5280174/the-underlying-provider-failed-on-connectionstring