When to instantiate my DataAccessAdapters?

Posts   
 
    
Ghostlight
User
Posts: 2
Joined: 04-Oct-2005
# Posted on: 04-Oct-2005 11:11:11   

Hi

We are having some severe performance problems using LLBLGEN with Microsoft Access, yet the same problems do not exist when we ported our app to SQL*Server. We believe that the root of the problem is the instantiation of our DataAccessAdapters. In our code, we "new" these things locally in each and every function or method which has to hit the database, and we then throw them away on exiting. This appears to be where the majority of the time is being taken (opening connection?).

We have taken a few step to change this approach and have declared reusable DataAccessAdapters that are now passed as parameters into small groups of related methods that hit the db. Already, performance is improving considerably with MS Access, so we think we are on the right track. We would like to take this further however, and are wondering about the other extreme....could we (should we?) declare a single application/global-level DataAccessAdapter which is passed as a parameter to each and every persistance method in our app. What would be the implications of such an approach? Is the DataAccessAdapter as stateful object?

Our app at present runs as a single thread on a single PC, though this will change in the future. The first major change will be 2 people running the app on 2 different PCs but targetting the same db (which could be anywhere). Long-term, we will be adding a multi-threaded aspect to the app. Would a single, global DataAccessAdapter cause problems in these situations?

Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Oct-2005 16:07:20   

First for the current situation, please refer to the following thread, which was discussing Access performance, and what to do to tune the performance of your application.

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3802

Also, if the creation of the adapter is the problem, it might be that the connection pooling isn't working.

Then, for your future scenarios, please note that the DataAccessAdapter isn't thread safe, you shouldn't share it among threads. Share it only within each thread.

You should also keep in mind that Access isn't designed for multi-user usage.