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