Interrupt DB Connection

Pavan Yadav

Member
Hi All,
I just struck up with a functionality, if it's available in progress or not. Or if yes then how it can be possible to cope up with this.
Problem is : I am connecting to a DB while working with some program as

Do:
.....
CONNECT Db-name with all parameters as required.
....
End.
But's it's taking long time to connect it. So i want that it should interrupt the Connection i.e should come out of this CONNECT if it's take more than 5-sec & leave it diconnected of whtever will be the status. If, it's get connected in 5-sec, than it's fine otherwise cancel it.

Please help me out for this.

Thanks..!!
 

RealHeavyDude

Well-Known Member
AFAIK, there is no way you can configure the timeout somewhere within Progress. It is a TCP timeout setting in the operating system. Commonly, AFAIK, the default is 30 seconds.

I don't know exactly where you can configure this value on different operating systems. But you need to be aware that this will affect everything trying a TCP connection if you configure it differently.

In the ABL you might want to use the NO-ERROR option on the connect statement to trap the error.

Regards, RealHeavyDude.
 

Pavan Yadav

Member
Thanks dude...!!

I don't require to track the error... But my whole motto is to timeout in 5-sec. Is there any mutiprogramming, multi threading concept in Progress??
I am using Version 9.1D.
 

RealHeavyDude

Well-Known Member
The 4GL always was single-threaded and is single-threaded in it's most recent release, OpenEdge 10.2B. Of course, 9.1d is long outdated and you should upgrade to a more recent version of OpenEdge 10.

There is some asynchronous functionality for AppServer requests and you might be able to achieve something similar with socket programming though.

Does the database reside on the same machine where your client runs? If that's the case you could connect the client via shared memory and thus bypassing the network layer. Connection as self service client will immediately return if the database can't be connected ...

HTH, RealHeavyDude.
 

Pavan Yadav

Member
Dude,
I am not too good in progress, to go for Socket Programming. & we are working UNIX env. Database & Application are on same server.
So i am not sure if i can go through with this approach.

Well, Thanks for Help me out. Is there any other way to think about?
 

RealHeavyDude

Well-Known Member
Bingo!

If the client and the database are on the same machine you should always utilize shared memory connection because it's much, much faster too compared to a remote client connect.

Instead of supplying the database name, -H and -S you just need to supply the path to the database file to the CONNECT statement to connect to the database and you will get an error immediately when the connect fails because there is no network involved.

Regards, RealHeavyDude.
 

Pavan Yadav

Member
I will try for it & will bug you again in case of further more clarification...doubts regarding this....

Thanks Dude...
 

Pavan Yadav

Member
Hey Dude....
One more doubt in this....
As u said
Instead of supplying the database name, -H and -S you just need to supply the path to the database file to the CONNECT statement to connect to the database and you will get an error immediately when the connect fails because there is no network involved
But, probably my connection is taking time due to poor server response or Large DB ... In that case what will happen?
 

RealHeavyDude

Well-Known Member
The size of the database and of how many files the database consist only matters if you are connecting single-user. That is, with no database server started.

But if the machine is down on it's knees that might very well impact performance on your connect statement.

Regards, RealHeavyDude.
 

RealHeavyDude

Well-Known Member
If you're connecting an Oracle database from the 4GL, I suppose you use the Oracle dataserver. The dataserver ( or the schema holder ) is a Progress database which just holds the schema of the Oracle database so that 4GL programs compile and run against it. I am not a dataserver specialist but I think you should be able to connect the dataserver database via shared memory too as long as it's on the same machine. AFAIK, the connection information how to connect the Oracle database is stored in the dataserver database.

But, connecting the dataserver is not the whole story here, because connecting the Oracle database will always only work via the network ... ah, there you are, network overhead and timeouts and all other sorts of ugly things ( just kidding ... ).

HTH, RealHeavyDude.
 

GregTomkins

Active Member
We always connect everything once at startup and since we run everything thru AppServers, eg. startup only really happens once at 3 AM and rarely after that, there are rarely any problems. If I had to connect remote databases all the time and wanted a faster timeout, I'd look at using non-blocking sockets, which you can get at via the Win32 API (I'm sure there is a UNIX equivalent, though I don't know what it is). You could try to open a socket to the DB and make sure it works before you do the CONNECT. That would not be totally bulletproof but should detect 95% of the problems nicely.
 
Top