Basically I want to pass some text from a field to be used as a log in.
Basically in my classes I have
this:
static final
String USERNAME = "root";
and
tableModel = new ResultSetTableModel1( JDBC_DRIVER, DATABASE_URL, USERNAME,
PASSWORD, DEFAULT_QUERY );
and in another class I have
public ResultSetTableModel1( String driver, String url,
String username, String password, String query )
throws SQLException, ClassNotFoundException
{
// load database driver class
Class.forName( driver );
// connect to database
connection = DriverManager.getConnection( url, username, password );
this all works fine, but obviously I am typing into the class all the url's, usernames etc.....is there a simple way that it can take that information from a textfield first?
That way I dont need String USERNAME = "root"; as the only way of logging on as someone OTHER than root is to change the code, which is not what I want