Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- Connection con = connect();
- ...
- }
- private Connection connect() {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- return DriverManager.getConnection("jdbc:mysql://localhost:3306/chat", "serveradmin", "password");
- } catch (Exception e) {
- System.out.println("Failed to obtain connection: " + e);
- System.out.println(e.getStackTrace());
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement