I wanted to conceptually know ...
If I have a class specifically doing some quering to database and giving results to jsp and servlet ... does this make sense? Static methods are ok ? Is it secure enough if I have all connection classes local to a method? can i make the connection global instead without compromising security ?
For example:
public class DatabaseUtility{
public static Sring getUsername(String employeeid)
{
Connection conn = ...........
Statement stmt = ........
rs executes query and gets a username and returns it...
}
public static Sring getAddress(String employeeid)
{
Connection conn = ...........
Statement stmt = ........
rs executes query and gets a address and returns it...
}
}