IBM DB2 Data Provider error

Topics: Development Team Discussion, User Discussion
Feb 4, 2010 at 3:51 PM

Hi,

I try to use the IBM DB2 Data Provider provided by EntLibContrib and have been created the mapping entry between IBM.Data.DB2 and EntLibContrib.Data.DB2.DB2Database.Unity is used as DI-Container and EntLib is registrated as extension:

....

Container.AddNewExtension<EnterpriseLibraryCoreExtension> ();
Container.AddNewExtension<DataAccessBlockExtension> ();

....


In the line where the DAAB-Extension will be registered the following error occures:

The required "ContainerPolicyCreatorAttribute" is not present in the supplied type "EntLibContrib.Data.DB2.DB2Database, EntLibContrib.Data.DB2, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null".

There seems to be a need for an implementation change. Or how to avoid the problem? If I use the generic Database-object with IBM Data Server Driver there is no problem.

 

Another question: is there an overview what the benfits from using the EntLibContrib provider? A first inspection over the EntLibContrib.Data.DB2.DB2Database class shows no further props or methods compared to Microsoft.Practices.EnterpriseLibrary.Data.Database.

 

Thanks for help

schue

Coordinator
Feb 12, 2010 at 1:43 PM

Hi Shue,

I have added the Unity Container for DB2Database objects into source code. In fact, I found that I had not created unity containers for any of the new Data Providers so these have been added also.

Thanks for highlighting this issue, it all goes to improve our contributions.

Cheers...   Steve

Feb 17, 2010 at 6:29 AM

It works, thanks a lot. :)

Coordinator
Feb 17, 2010 at 11:10 AM

Hi Shue,

That is good news. incidentally I noticed you had asked a question that I had overlooked. The DB2Database provider should not really be used in your code.  It is a provider for the DAAB so that you can use the generic Microsoft.Practices.EnterpriseLibrary.Data.Database in your code and use the console to configure the DAAB to create DB2Database instances so that the generic Database talks to a DB2 database.  That way should you ever change your database type you simply reconfigure to, say, MySqlDatabase for example and your code continues unchanged using the generic database but now it talks to MySql.  The DAAB is a classic example of the Factory pattern.

Cheers...   Steve

Feb 26, 2010 at 11:17 AM

Hi Steve, thank you. Im using of cource the generic Database-Class. Because of the SQLCeDataBase-class i was assuming the DB2database-class has similar additionaly features for 'end-users'. I understand your comment and I am aware of the mission of the generic approach. Have a nice day!