Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Static methods in class accessed by jsp/servlet

843836Feb 25 2005 — edited Mar 9 2005
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...
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 6 2005
Added on Feb 25 2005
9 comments
666 views