Article View: comp.sys.next.programmer
Article #1978Re: dbkit and sybase server connections
From: Timothy J. Wood
Date: Mon, 28 Dec 1992 23:13
Date: Mon, 28 Dec 1992 23:13
61 lines
2092 bytes
2092 bytes
estrin!kswanson (Kevin Swanson) writes:
>I'm working on an application that uses dbkit along with sybase.
>I've come across the problem that my application makes two and sometimes
>three connections to the sybase server, when it really should only need
>a single connection.
>Has anyone who has worked with dbkit experienced any problems like this?
Yes, actually. The problem is that DBBinder defaults to use non-shared
context (this is where the connection is stored) when you really want it to
share the context. You can set the context sharing with
[aBinder setSharesContext: flag];
What I did to get around this problem was to impelement a subclass of
DBBinder called SharedBinder that goes something like:
#import <dbkit/dbkit.h>
@interface SharedBinder : DBBinder
{
}
- init;
- setSharesContext: (BOOL) flag
@end
@implementation SharedBinder
- init
{
return [[super init] setSharesContext: YES];
}
- setSharesContext: (BOOL) flag
{
return [super setSharesContext: YES];
}
@end
To get this to effect the binders that DBKit sets up for you, you will
have to do a:
[SharedBinder poseAs: [DBBinder class]];
before they are allocated. The best place is probably in you *_main.m
file or in your appWillInit: method.
You will want to note that sharing context with other DBBinders disables
flushing. I haven't experienced any problems with this, but depending upon
what you are doing, you might.
>thanks,
>kevin
>kswanson@rdr.com
Timothy J. Wood
The Omni Group
DBKit Consulting
Technical Details
Message-ID:
<1ho1nmINNkt9@shelley.u.washington.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!gatech!destroyer!cs.ubc.ca!uw-beaver!news.u.washington.edu!stein.u.washington.edu!bungiReferences:
<1992Dec28.201019.4259@rdr.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!gatech!destroyer!cs.ubc.ca!uw-beaver!news.u.washington.edu!stein.u.washington.edu!bungi From: bungi@stein.u.washington.edu (Timothy J. Wood) Newsgroups: comp.sys.next.programmer Subject: Re: dbkit and sybase server connections Date: 28 Dec 1992 23:13:58 GMT Organization: University of Washington Lines: 61 Message-ID: <1ho1nmINNkt9@shelley.u.washington.edu> References: <1992Dec28.201019.4259@rdr.com> NNTP-Posting-Host: stein.u.washington.edu