Originally Posted by
copeg
It sounds like you want each user to have a specified username/password for the database? You might consider a model which requires just a few username/password pairs for database access, each of which defines different select/update/delete access to the database tables. So rather than having a username/password defined for database login for each user, you define access right groups, which users are members of. From there, you could have a table which contains the username, MD5 password, and access right...which can be queried for each user to determine the access rights and login to the database with the username/password corresponding to those rights.
Ill explain a bit better. I have the mysql community server vs 5.1.51 running on my desktop pc at home. If im at university or somewhere else other than home i want this program to be able to connect to it, which it can. I log in as the root user as im the only one so i have all permissions etc. I just want to no how to 'securely' login i guess.
try
{
Class.forName("com.mysql.jdbc.Driver");
String url = addressTextField.getText();
String userName = getLoginDetails(loginTextField);//gets username
String passWord = getLoginDetails(passWordTextField);//gets pass
con = DriverManager.getConnection(url,userName, passWord);
stmt = con.createStatement();
conInfoTextArea.setText("URL: " + url + "\n" + "Connection: " + con);
}
public String getLoginDetails(JTextField tf)
{
return logindets = tf.getText();//string that holds login dets which is user/pass
}
Now that code there is just sending the username, and password to the url, which is the mysql server. How can i do this safely with encryption or some other method? or is that fine and secure as it is?