Solved

Connecting to SQL after a long period of downtime

Posted on 2004-10-18
20
197 Views
Last Modified: 2010-04-15
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
Comment
Question by:jvoros1
  • 8
  • 5
  • 2
  • +1
20 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12341896
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
 
LVL 10

Expert Comment

by:smegghead
ID: 12343186
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
 

Author Comment

by:jvoros1
ID: 12346663
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12346822
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
 

Author Comment

by:jvoros1
ID: 12346921
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12346955
What I was really interested in is:  Does this only happen once during the day?

Bob
0
 

Author Comment

by:jvoros1
ID: 12347222
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
 

Author Comment

by:jvoros1
ID: 12347467
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 10

Expert Comment

by:smegghead
ID: 12347686
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
 

Author Comment

by:jvoros1
ID: 12347762
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
 
LVL 96

Accepted Solution

by:
Bob Learned earned 125 total points
ID: 12349828
That's why I suggest a single scheduled task that will "wake" up the computer--whatever that task should be.

Bob
0
 

Author Comment

by:jvoros1
ID: 12350832
Ok, like what kind of task can I run?

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12350868
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
 
LVL 2

Assisted Solution

by:Dom_Cotton
Dom_Cotton earned 125 total points
ID: 12357742
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
 

Author Comment

by:jvoros1
ID: 12358569
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
 
LVL 2

Expert Comment

by:Dom_Cotton
ID: 12358628
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
 

Author Comment

by:jvoros1
ID: 12359253
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now