4 |
import java.io.PrintWriter; |
import java.io.PrintWriter; |
5 |
import java.sql.Connection; |
import java.sql.Connection; |
6 |
import java.sql.SQLException; |
import java.sql.SQLException; |
7 |
|
import java.sql.Statement; |
8 |
|
|
9 |
import javax.servlet.ServletException; |
import javax.servlet.ServletException; |
10 |
import javax.servlet.annotation.WebServlet; |
import javax.servlet.annotation.WebServlet; |
13 |
import javax.servlet.http.HttpServletResponse; |
import javax.servlet.http.HttpServletResponse; |
14 |
|
|
15 |
|
|
16 |
@WebServlet("/DbConnectionTest") |
@WebServlet("/DbConnectionProbe") |
17 |
public class DbConnectionTest extends HttpServlet { |
public class DbConnectionProbe extends HttpServlet { |
18 |
private static final long serialVersionUID = 1L; |
private static final long serialVersionUID = 1L; |
19 |
|
|
20 |
public DbConnectionTest() { |
public DbConnectionProbe() { |
21 |
super(); |
super(); |
22 |
// TODO Auto-generated constructor stub |
// TODO Auto-generated constructor stub |
23 |
} |
} |
28 |
|
|
29 |
out.print("<html><head><title>DaoAdresseService</title></head><body>"); |
out.print("<html><head><title>DaoAdresseService</title></head><body>"); |
30 |
out.print("<h2>DaoAdresseService</h2>"); |
out.print("<h2>DaoAdresseService</h2>"); |
31 |
try { |
|
32 |
Connection conn = DBConnection.getConnection(); |
try ( |
33 |
conn.close(); |
Connection conn = DBConnection.getConnection(); |
34 |
|
Statement stmt = conn.createStatement() |
35 |
|
) { |
36 |
|
|
37 |
|
stmt.executeQuery("SELECT 1"); |
38 |
|
|
39 |
out.print("Got DB Connection"); |
out.print("Got DB Connection"); |
40 |
|
|
41 |
} catch (SQLException e) { |
} catch (SQLException e) { |