• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

JDBC and user login

Incinerator

Limp Gawd
Joined
Aug 31, 2005
Messages
252
I want to try to make a program in Java that has multiple users but I've never done anything like that in Java. In the past (working with basic websites) I've found that it was easy to store usernames and their associated password in a database and when they log in to just compare the input to the db.

I was wondering if this was the easiest way to accomplish a basic user login (without having it hardcoded) and if any of you have some pointers or advice. Right now I just want something really simple, not going to worry about encryption or anything until I get the basics down.
 
Is this a web/network app? If it isn't you could just use XML flat files and create/parse them with JDOM. XML is of course optional you could just use a flat properties file using java.util.Properties or any custom file format you wish. You could even create User beans and flatten them via serialization (see java.io.Serializable). There are a lot of choices.

If it is a network/web app then you probably should use a database. You can use the JavaDB (Apache Derby) and embed it in your server side web app, or if you need something beefier PostgreSQL or MySQL. The Apache Derby website has a great example for using JDBC to interface with databases regardless of which DB you do choose so its a good starting point.
 
Last edited:
Back
Top