/[projects]/dao/DaoAdresseService/src/dk/daoas/daoadresseservice/db/DbConnectionProbe.java
ViewVC logotype

Annotation of /dao/DaoAdresseService/src/dk/daoas/daoadresseservice/db/DbConnectionProbe.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2269 - (hide annotations) (download)
Thu Feb 12 14:26:36 2015 UTC (9 years, 3 months ago) by torben
File size: 1203 byte(s)
Rename connectiontest to connectionprobe
1 torben 2267 package dk.daoas.daoadresseservice.db;
2    
3     import java.io.IOException;
4     import java.io.PrintWriter;
5     import java.sql.Connection;
6     import java.sql.SQLException;
7    
8     import javax.servlet.ServletException;
9     import javax.servlet.annotation.WebServlet;
10     import javax.servlet.http.HttpServlet;
11     import javax.servlet.http.HttpServletRequest;
12     import javax.servlet.http.HttpServletResponse;
13    
14    
15 torben 2269 @WebServlet("/DbConnectionProbe")
16     public class DbConnectionProbe extends HttpServlet {
17 torben 2267 private static final long serialVersionUID = 1L;
18    
19 torben 2269 public DbConnectionProbe() {
20 torben 2267 super();
21     // TODO Auto-generated constructor stub
22     }
23    
24     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
25     response.setContentType("text/html");
26     PrintWriter out = response.getWriter();
27    
28     out.print("<html><head><title>DaoAdresseService</title></head><body>");
29     out.print("<h2>DaoAdresseService</h2>");
30     try {
31     Connection conn = DBConnection.getConnection();
32     conn.close();
33     out.print("Got DB Connection");
34    
35     } catch (SQLException e) {
36     out.print("DB Connection failed: " + e.getMessage());
37     }
38    
39    
40     }
41    
42     }

  ViewVC Help
Powered by ViewVC 1.1.20