Can I bring in data from a DB2 database?

Topics: Writing modules
Aug 10, 2011 at 6:49 AM

I have a need in my module to bring in data from a DB2 database (read only). I don't need to update or write anything to it, I just need to be able to read from a few tables.

My previous application (non Orchard, and non MVC) used an Entity Framework Model to do this, but the posts I've read on here so far have indicated that's not a good choice for Orchard.

Do you have any suggestions on how I can connect to a DB2 database and read in values from within my module?

Thanks so much!

Aug 10, 2011 at 7:57 PM

You should be fine as long as you isolate yourself from the Orchard ambient transaction

Aug 10, 2011 at 8:53 PM

Holy crap it worked...I was so not expecting it to be as simple as wrapping my code with that. THANK YOU!!!

I did have to move the connection string for the EFM to the web.config in Orchard.Web instead of my project. I hate adding things to it, but it's something I can easily duplicate if I upgrade the solution.