Print Thread
Connecting at runtime is very slow (!?)
#750 08/09/00 10:45 PM
Joined: Aug 2000
Posts: 3
ITALY
R
Member
OP Offline
Member
R
Joined: Aug 2000
Posts: 3
ITALY
I have this strange problem: if I set the property connected at true in the TOracleSession at the design phase, the connection is fast (few ms, even if I create the Data Module where I put then components dinamically). If I set the connected at false in the design phase and then I set it at true at runtime (of course first I set the right values for database username and password), the connection is very slow (2-3 seconds). I use a Oracle 8i version on a Sun Solaris Parallel Server.

Can anyone help me?
Thanks,
Riccardo.

Re: Connecting at runtime is very slow (!?)
#751 08/10/00 06:19 PM
Joined: Aug 1999
Posts: 22,206
Member
Offline
Member
Joined: Aug 1999
Posts: 22,206
I assume this is on the same PC? Maybe the effect you are seeing is a result of Net8 initialization. For a runtime application, the first connection will also initialize Net8. Subsequent connections will be faster. You can determine the Net8 initialization time at runtime by calling the InitOCI procedure in the OracleCI unit and timing it. If it is slow, then maybe there is a problem with the search path (e.g. network directories), or with the files that Net8 implicitly uses (e.g. tnsnames.ora).

In the IDE this behavior will of course be the same, but you may not be aware of it. If the Connected property of a session is True at design time, Net8 will be initialized when you open the project. For the remainder of the IDE lifetime Net8 stays initialized.

------------------
Marco Kalter
Allround Automations

[This message has been edited by mkalter (edited 10 August 2000).]


Marco Kalter
Allround Automations
Re: Connecting at runtime is very slow (!?)
#752 08/10/00 09:56 PM
Joined: Aug 2000
Posts: 3
ITALY
R
Member
OP Offline
Member
R
Joined: Aug 2000
Posts: 3
ITALY
I also supposed so, but I create the datamodule dinamically at runtime when I need to connect, so the global connection time would be the same (when the program start, the TOracleSession component does not exist). If I execute the steps:
1) At design time I set the right server,username,password and connected at true,
but the datamodule is not autocreated when the program starts.
2) When I need to connect I create the datamodule in which I put the TOracleSession component. Because of the setting of the properties (see 1), the creation and connection happen at the same time.
3) I Execute the query.

Doing so, the creation of the TDatamodule with a connected session is very fast. I do the job in few milliseconds.

Instead, if I execute
1) At design time I don't set right server, username and password and I set connected at false.
2) When I need to connect I create the datamodule. Then, I set right server etc. and connected at true.
3) I execute the query.

Doing so, the setting of connected at true needs 2-3 seconds. I need this time to do the job! The strange thing is: I have also the same version of Oracle on Linux and with it the problem does not exist, it happens only when I connect to Oracle on Sun Solaris.

What can I do? :-)

Re: Connecting at runtime is very slow (!?)
#753 08/11/00 06:46 PM
Joined: Aug 1999
Posts: 22,206
Member
Offline
Member
Joined: Aug 1999
Posts: 22,206
There is of course no real difference between setting these logon properties at design time or run time. The only difference may be the timing. Perhaps some event handlers in the data module fire with a different value for the Connected property of the session? Something like that.

I see that there is also a query involved, not just a logon. Have you determined which action takes up these 2 or 3 seconds? Can you use SQLTrace and tkprof to find out what is going on on the server?


------------------
Marco Kalter
Allround Automations


Marco Kalter
Allround Automations
Re: Connecting at runtime is very slow (!?)
#754 08/17/00 09:15 PM
Joined: Aug 2000
Posts: 3
ITALY
R
Member
OP Offline
Member
R
Joined: Aug 2000
Posts: 3
ITALY
I tried the InitOCI call and it's fast.
The settings of tnsnames.ora are correct.
The time of 2-4 seconds is the only connection time, it's not the query time.
There isn't any event handlers setting.
The server does not do nothing during this 2-4 seconds because the connection hasn't been created yet.
I made lots of tests and I'm absolutely sure that when I connect to sun machines (we have two different sun machines), if I set the connection at true at designtime, when I create the connected component it takes 80 ms, when I set the connection at false at designtime and then I set at true at runtime, the only connection time is 2-4 seconds...
I think that something different happens when the components are connected at runtime, something that waste a lot of time... If I connect to Oracle on Linux machines I don't have this problem. For me it's a rather big problem because I need to connect quickly to the server and I can't specify the logon data at design time.


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.124s Queries: 13 (0.080s) Memory: 2.5178 MB (Peak: 3.0393 MB) Data Comp: Off Server Time: 2024-05-01 07:38:21 UTC
Valid HTML 5 and Valid CSS