Disconnected Mode
-
PoSeiDoN31
- Posts: 6
- Joined: Wed 12 Sep 2007 15:35
Disconnected Mode
Hi I've been working with MyDac and I've created an application connecting to MySql. I'm working with disconnected mode and pooling, but i was testing some problems and i completely disconnect the TMyConnection component, this means, that i set the properties:
- Connected = false
- Disconnected Mode = false
- Pooling = false.
The problem is that when i open the TMyQuery component, it connects to the database when it was suppose to throw an exception.
I need your help to figure out this problem.
Thanks.
Oh and I'm new in the forum. i think i can help you with some problems too.
- Connected = false
- Disconnected Mode = false
- Pooling = false.
The problem is that when i open the TMyQuery component, it connects to the database when it was suppose to throw an exception.
I need your help to figure out this problem.
Thanks.
Oh and I'm new in the forum. i think i can help you with some problems too.
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
Re: Disconnected Mode
inform more details, what exception are raised?PoSeiDoN31 wrote:Hi I've been working with MyDac and I've created an application connecting to MySql. I'm working with disconnected mode and pooling, but i was testing some problems and i completely disconnect the TMyConnection component, this means, that i set the properties:
- Connected = false
- Disconnected Mode = false
- Pooling = false.
The problem is that when i open the TMyQuery component, it connects to the database when it was suppose to throw an exception.
I need your help to figure out this problem.
Thanks.
Oh and I'm new in the forum. i think i can help you with some problems too.
-
PoSeiDoN31
- Posts: 6
- Joined: Wed 12 Sep 2007 15:35
The problem is that it doesn't throw the exception.
Let me explain better, i have a TMyConnection component pointing to a database and a TMyQuery component that calls a Stored Procedure.
I've set all the properties in the TMyConnection component to be disconnected like i explained in the last post. so that means that i shouldn't be able to execute the query. but when i call the open method of the query it automatically connects to the database and i don't think that is what should happen. i also have the property of the TMyQuery component named Create Connection set to False.
i don't understand why it connects and execute the query when everything is disconnected.
I'll appreciate your help
Let me explain better, i have a TMyConnection component pointing to a database and a TMyQuery component that calls a Stored Procedure.
I've set all the properties in the TMyConnection component to be disconnected like i explained in the last post. so that means that i shouldn't be able to execute the query. but when i call the open method of the query it automatically connects to the database and i don't think that is what should happen. i also have the property of the TMyQuery component named Create Connection set to False.
i don't understand why it connects and execute the query when everything is disconnected.
I'll appreciate your help
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
See mydac Help
in MyDAC Help;;PoSeiDoN31 wrote:The problem is that it doesn't throw the exception.
Let me explain better, i have a TMyConnection component pointing to a database and a TMyQuery component that calls a Stored Procedure.
I've set all the properties in the TMyConnection component to be disconnected like i explained in the last post. so that means that i shouldn't be able to execute the query. but when i call the open method of the query it automatically connects to the database and i don't think that is what should happen. i also have the property of the TMyQuery component named Create Connection set to False.
i don't understand why it connects and execute the query when everything is disconnected.
I'll appreciate your help
In disconnected mode a connection opens only when it is required. After performing all server calls connection closes automatically until next server call is required. Datasets remain open when connection closes. Disconnected mode may be useful to save server resources and operate in unstable or expensive network. Drawback of using disconnected mode is that each connection establishing requires some time for authorization. If connection is often closed and opened it can slow down application work. We recommend to use pooling to solve this problem. For additional information see TCustomDAConnection.Pooling.
To enable disconnected mode set TCustomDAConnection.Options.DisconnectedMode to True.
In disconnected mode a connection is opened for executing requests to the server (if it was not already opened) and is closed automatically if it is not required any more. If the connection was explicitly opened (Connect method was called or Connected property was explicitly set to True), it does not close until Disconnect method will be called or Connected property will be explicitly set to False.
Disconnected mode features
If you perform a query with FetchAll option set to true, connection closes when all data are fetched if it is not used by someone else. If FetchAll option is set to false, connection does not close until all data blocks are fetched.
If explicit transaction is started, connection does not close until the transaction will be committed or rolled back.
If the query was prepared explicitly, connection does not close until the query will be unprepared or its SQL text will be changed.
-
PoSeiDoN31
- Posts: 6
- Joined: Wed 12 Sep 2007 15:35
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
wait...
We go to wait a better explanation of Antaeus.PoSeiDoN31 wrote:i already read that. but the thing is that i have disconnected mode disabled. so that won't help me.
Thanks anyway
certainly Antaeus goes to help you better.