The underlying provider failed on ConnectionString

拟墨画扇 提交于 2019-12-11 08:54:50

问题


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=&quot;Database=DCCPDEVL;User ID=documakr;Password=Dcpd@123;server.com:60000&quot;" 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=&quot;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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!