Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

Connecting to SQL after a long period of downtime

Ok, I wrote a program that stays constantly open on a desktop for 24/7 during a work week. Basically it swipes in and out users (like a punch clock). So for example, someone will enter in their employee ID at 6:00 AM and then again at 3:00PM when they leave.

It works perfectly, other than the FIRST person to use it at the beginning of the day, it takes a few seconds for the program to do something (Either connect to the DB or somethign to do with Garbage Collection) so when the first person uses it , they think there is something wrong with it and try to punch in "multiple" times. I've tried putting in "Please wait" messages, but i stil have the same problem

I guess my question is...how to make them wait while the system connects...? i've tried putting in a "Please wait" message, but the system just logs them in multiple times still.

Is there a way to stop all the processes until its connected, or ?


Thanks in advance.


0
jvoros1
Asked:
jvoros1
  • 8
  • 5
  • 2
  • +1
2 Solutions
 
Bob LearnedCommented:
Does the computer have any power down options set?  Or, does the computer sit there as if someone was always there?  Is there a screen saver running?

You might be able to schedule a small job that wakes up the computer before someone comes in in the morning.

Bob
0
 
smeggheadCommented:
Why don't you just set a timer to make a dummy call to the database every 5 mins (or whatever, just see what you can get away with). This should keep the application 'alert'.

Smg.
0
 
jvoros1Author Commented:
The comptuer doesn't have any power options, or screen savers set. It just sits there until someone signs in.

I may try the dumby call to the database every 10 minutes or so..that might be a good temporary solution.. anyone else think of anything?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Bob LearnedCommented:
Does this only happen once, in the morning after the first person tries to access the system?  If so, every 10 minutes seems like overkill to me.

Bob
0
 
jvoros1Author Commented:
Some how I dont think its the connection, because I do connect to the SQL Database every hour.

Do you think it has to do with some sort of Garbage Collection?
0
 
Bob LearnedCommented:
What I was really interested in is:  Does this only happen once during the day?

Bob
0
 
jvoros1Author Commented:
It happens usually when the system has been sitting for about 3 or 4 hours, anytime during the day, regardless if I'm connecting threw the program or not.

If the software has been sittign without user input for about 4 hours, it "stalls" for about 4 or 5 seconds before it "connects" to the database, even though I do have the connection hitting it every hour, on the hour.

Therefore, I believe it has to be something with the software or o/s, because it does connect every hour ( I can see it connect )....
0
 
jvoros1Author Commented:
actually, it seems that it only happens ONCE per day... every morning..when the first person uses the machine..thats what i was being told by the person downstairs.
0
 
smeggheadCommented:
maybe your hard-disk has a spin-down time-out on it.. do you hear any whirring inside your machine when it comes out of this 'sleep'

0
 
jvoros1Author Commented:
I"m not sure, usually the people sign in at like 5:30am, so I'm not here to expereince the problem

I try to replicate it on my test machine, but its near impossible.
0
 
Bob LearnedCommented:
That's why I suggest a single scheduled task that will "wake" up the computer--whatever that task should be.

Bob
0
 
jvoros1Author Commented:
Ok, like what kind of task can I run?

0
 
Bob LearnedCommented:
Something simple:  Create a batch file that gives you a directory of the %SystemRoot% directory to a text file.  Anything that requires that the drive spin up.

Schedule it as a recurring task in Task Scheduler.

Bob
0
 
Dom_CottonCommented:
Hi,

A simple thought but will say it anyway...

Does your app connect to the database on start-up and then just fire SQL at it to perform the "clock" or "swipe"?  I have written similar apps - and where there is very little to do with the database it just connects, executes, then disconnects for each action or user.  Another way is to have a separate thread that performs the code connecting to the database so that the user gets the impression that he/she has completed his/her task straight away, but in reality the thread could continue to execute until it has done it's job then quietly and invisibly disconnect and wait for the next user.

Just some thoughts that may help....

DJ
0
 
jvoros1Author Commented:
DJ: its a good idea, and initally i wanted to do that, however, i have to query the database for their user name

do you think it woudl be wise to use XML and update the database later on in a batched mode?
0
 
Dom_CottonCommented:
is the querying of the name for display purposes - i.e. to say like "Welcome, Dom!" or is it for another purpose..... ?

Batching things up will only work as long as the clockings are being made for time sheets.  We use our clocking system for fire/evacuation reasons too so it must be real time.....

I suppose another way to do this would be to show the time on the display - and obtain the time from the database - that way the session will (or should) stay alive then you can do live updates.

HTH,
DJ
0
 
jvoros1Author Commented:
Yah its for display purposes..

to show the last time they clocked in, their name.. ..etc

i stll haven't figured the root of the problem, so its hard to make a solution...
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 8
  • 5
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now