Thread View: borland.public.delphi.database.bdp
5 messages
5 total messages
Started by john
Mon, 05 Mar 2007 22:13
bdp connects without asking
Author: john
Date: Mon, 05 Mar 2007 22:13
Date: Mon, 05 Mar 2007 22:13
15 lines
1681 bytes
1681 bytes
.Net v1.1, BDS 2006, Oracle This is something I dont understand. If you create a bdpconnection in designer, and a command, it will initiate database communications in the InitializeComponent() call WITHOUT you even asking. By asking I mean calling dataadapter Fill(), or command.Execute(). As soon as the connection is assigned to the command in the generated code it tries to talk to the database. Database connections can fail and throw exceptions. So you can have exceptions thrown from your form constructor that are unexpected. Unexpected maybe is a bad word, let me say unwanted. Im not ready to talk to the database yet! It may be offline, the network maybe down, etc.. Why is this? Do other ado.net providers have this behavior?
Re: bdp connects without asking
Author: Robin
Date: Tue, 06 Mar 2007 05:50
Date: Tue, 06 Mar 2007 05:50
30 lines
2299 bytes
2299 bytes
john wrote: > .Net v1.1, BDS 2006, Oracle > > This is something I dont understand. If you create a bdpconnection in > designer, and a command, it will initiate database communications in the > InitializeComponent() call WITHOUT you even asking. By asking I mean calling > dataadapter Fill(), or command.Execute(). As soon as the connection is > assigned to the command in the generated code it tries to talk to the > database. > > Database connections can fail and throw exceptions. So you can have > exceptions thrown from your form constructor that are unexpected. Unexpected > maybe is a bad word, let me say unwanted. Im not ready to talk to the > database yet! It may be offline, the network maybe down, etc.. > > Why is this? Do other ado.net providers have this behavior? Personally, I don't connect the BDPConnection in the IDE. I do it in code when I want to use it. Normaly getting the connection properties from Web.Config. Otherwise the DB always has to be in the same spot. That said, I have real trouble with this, as if I *DO* open the connection in the IDE, I have to remember to explicitly remove the connection string before compiling. -- Robin. Australian Bridal Accessories := http://www.bridalbuzz.com.au Turbo for Noobs (a work in progress) := http://turbofornoobs.blogspot.com/
Re: bdp connects without asking
Author: Bob Swart
Date: Tue, 06 Mar 2007 06:38
Date: Tue, 06 Mar 2007 06:38
19 lines
1797 bytes
1797 bytes
Hi John,
> This is something I dont understand. If you create a bdpconnection in
> designer, and a command, it will initiate database communications in the
> InitializeComponent() call WITHOUT you even asking. By asking I mean calling
> dataadapter Fill(), or command.Execute(). As soon as the connection is
> assigned to the command in the generated code it tries to talk to the
> database.
Try to set Connection Pooling to False at design-time (and back to True
at runtime when you assign your final runtime Connection String).
Groetjes,
Bob Swart
--
Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
Blog: http://www.drbob42.com/blog - RSS: http://drbob42.com/weblog.xml
New Delphi 2006 Courseware e-books at http://www.eBob42.com/courseware
Re: bdp connects without asking
Author: john
Date: Tue, 06 Mar 2007 18:41
Date: Tue, 06 Mar 2007 18:41
20 lines
1794 bytes
1794 bytes
"Bob Swart" <b.swart@chello.nl> wrote in message news:45ED0C4F.8090201@chello.nl... > Hi John, > >> This is something I dont understand. If you create a bdpconnection in >> designer, and a command, it will initiate database communications in the >> InitializeComponent() call WITHOUT you even asking. By asking I mean >> calling dataadapter Fill(), or command.Execute(). As soon as the >> connection is assigned to the command in the generated code it tries to >> talk to the database. > > Try to set Connection Pooling to False at design-time (and back to True at > runtime when you assign your final runtime Connection String). > Yes that did it. No exceptions from InitializeComponent(). Well I havent tried then renabling pooling but its not necessary for this app. thanks Bob Swart
Re: bdp connects without asking
Author: john
Date: Fri, 16 Mar 2007 23:58
Date: Fri, 16 Mar 2007 23:58
4 lines
1083 bytes
1083 bytes
hmm something else I forgot to mention about this issue that is bad. You can't simply trap the exception. It will have caused an early exit from your InitializeComponent() method... which will probably leave your object pretty well trashed.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads