I have a general question regarding mysql queries and java. Can you take a value that has been entered into a textbox by a user then assign that to a String, then in a whole separate class capture that String to fulfill the parameter in a mysql query. The mysql query would run and if the parameter is equal to the data in the table it will return a message of successful login etc. So I am asking for a yes or no style answer on this…any extra input would be helpful but not required. I know you can pass values from one class to another but in this instance I do wonder if it is possible in the running of a mysql query.
I have a general question regarding mysql queries and java. Can you take a
Share
Of course it’s possible. How would we implement applications using a database if it weren’t:
In GUI:
In UserDAO:
Note that the above is only pseudo-code. It doesn’t handle exceptions and doesn’t close resources properly. It’s just to give you an idea.
Learn about prepared statements.