Re: ado connection object in vb6
- From: "wb" <none>
- Date: Thu, 24 Apr 2008 21:43:18 -0700
Ok, now I am confused. One person recommends local objects, you recommend
global objects.....
The basic model that I have used inside the dll is that when I need to
access the database I create a string variable and write the SQL. Then I
use a local adodb.recordset object (lets call it objRS) and I code a line
objRS.Open ("SQL string", global ado.connection).
I populate the record data into the object I am dealing with, say a
customer, and then I close the recordset and set it to nothing
WB
"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
news:OZOPIqKpIHA.3900@xxxxxxxxxxxxxxxxxxxxxxx
"wb" <none> wrote in message news:u2V0q0IpIHA.4616@xxxxxxxxxxxxxxxxxxxxxxx
I am working through some performance issues with regards to Insert andbasically
Update procedures using a global connection object. During the first
lifecycle of my project, I used an activex dll to store all my classes
and
within each class they use this global connection object to interface
with
the database (SQL Server). On the most recent update I needed to use the
global connection object within my exe project so I just created a second
global connection object to the same DSN as the activex dll. So I
have two, one for all the classes within the dll and one for all theinsert
other
"needs" within the exe. Both are created within modules at the time the
program launches.
The end result, the application slows way down when doing any type of
or update. Is there a limit on the number of connection objects? Should
the objects be global or local variables?
wb
There is little wrong with a 'global' connection object in a VB6
application. In fact it is preferred over the over-head of continuously
creating and destroying an ADODB.Connection object. ADO uses Connection
Pooling. Opening and closing a Connection object just before use is a
useful
practice as it helps the pool to be more efficient.
I doubt that creating two Connection objects is an issue in this case,
since
both would share the same connection pool. It wouldn't hurt to try and
just
use one. Pass the Exe's to the Dll. Again, doubt you would see much
change.
But continuously creating and destroying a Connection object will decrease
performance.
You mentioned a 'DSN'. Does this mean you are using an ODBC driver, or OLE
for OLEDB? If you are, then immediately change your connection to use an
OLE
DB provider. Depending on SQLServer version you may want to use the native
provider. Likely not a complete cure, but should help.
There is a performance issue with SQLServer in that it can only open one
for
ward-only server-side cursor per connection at one time. So multiple
requests can 'stack-up' so to speak. Not sure how this might relate your
problem. You might piddle around with different cursor types, etc. for
separate commands. You might be having locking issues.
Migrating to a MTS model is only useful if you are in fact using
Transactions.
But then how are you doing your inserts and updates? Some techniques are
more efficient than others. Just adopting more stored procedures is likely
to add a magnitude of improvement.
We need more details.
-ralph
.
- Follow-Ups:
- Re: ado connection object in vb6
- From: William Vaughn [MVP]
- Re: ado connection object in vb6
- From: Ralph
- Re: ado connection object in vb6
- From: Ralph
- Re: ado connection object in vb6
- From: Jan Hyde (VB MVP)
- Re: ado connection object in vb6
- References:
- ado connection object in vb6
- From: wb
- Re: ado connection object in vb6
- From: Ralph
- ado connection object in vb6
- Prev by Date: Re: ADO Chunk Operations Truncated at 511,000 Bytes for Updates
- Next by Date: Re: ado connection object in vb6
- Previous by thread: Re: ado connection object in vb6
- Next by thread: Re: ado connection object in vb6
- Index(es):
Relevant Pages
|
Loading