Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Guard g;
- public Connection dajSpojenie(HttpServletRequest request) {
- try {
- HttpSession session = request.getSession();
- if(session.getAttribute("spojenie")==null){
- Class.forName("com.mysql.jdbc.Driver");
- Connection c = DriverManager.getConnection("jdbc:mysql://localhost/shop", "root", "");
- g = new Guard(c);
- return c;
- }else{
- return (Connection)session.getAttribute("spojenie");
- }
- }catch(Exception e){
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement