Session or global variable

On my application, there is a login section that connects to a SQL database to verify if the username and password match in an existing row. If so, it will get the value of different columns for that user and store them in a variable. When I first made this in PHP, I used a session to store the username and I think that was it, but it was obviously a web-based situation. Now I'm making it an application so whenever the user closes the program, all the info is gone until they run it again and login. That's the same way my session worked. The only question I really have is should I use a session that expires after so long or just use global variables for the stuff and write a method to "logout" that will set the variables back to null and prompt the user to log back in again to advance?

[804 byte] By [tristanlee85a] at [2007-11-27 6:56:16]
# 1
Use a session.
Navy_Codera at 2007-7-12 18:33:12 > top of Java-index,Java Essentials,Java Programming...
# 2
So should I just have it expire after so many seconds, set any modified JLabels back to their original text, reset the variables that aren't included in the session back to null and require thm to login again?
tristanlee85a at 2007-7-12 18:33:12 > top of Java-index,Java Essentials,Java Programming...
# 3
Is this an application where you expect that different users will walk up to the public computer where it's running and use it? Or is it an application that somebody will run on a computer for their personal use?
DrClapa at 2007-7-12 18:33:12 > top of Java-index,Java Essentials,Java Programming...
# 4

It's something where you can install it on a personal computer and I'm going to put it on the computer at work as well. It doesn't have extremely confidential information. It's only used to create evaluations for employees, store them in a databse, and print out the pages at any time. Some managers will have 25 - 30 evaluations to give within a week period and doing it this way is much more efficient that doing them all by hand.

I was looking into sessions and I only found information on them when using JSP, JSTL, and something else, nothing application related.

tristanlee85a at 2007-7-12 18:33:12 > top of Java-index,Java Essentials,Java Programming...
# 5
> work as well. It doesn't have extremely confidential> information. It's only used to create evaluations for> employees,How are employee evaluations not extremely confidential?
jverda at 2007-7-12 18:33:12 > top of Java-index,Java Essentials,Java Programming...
# 6

Well, i understand where you are coming from. I guess evaluations wasn't the right term. We go over Critical Safe Behavior, Critical Handling Behavior, and a few other things. It's not as confidential as my yearly review, but it's also not best to leave these documents lay in the complete open.

Can sessions be used within the application? I'm thinking about it like if you're at work and you leave Outlook open, there's no timeout on it. If someone get's on the computer they can read your e-mail.

tristanlee85a at 2007-7-12 18:33:12 > top of Java-index,Java Essentials,Java Programming...
# 7

It's much harder to figure out when a Swing application hasn't been used for X seconds. Somehow you have to track all keystrokes and all mouse clicks and button presses and so on, and have timers running that are cancelled when one of those happens, and so on. You could do it but it could be messy.

This is perhaps why you don't see many applications that have logout timers built into them.

DrClapa at 2007-7-12 18:33:12 > top of Java-index,Java Essentials,Java Programming...