26 |
response.setContentType("text/html"); |
response.setContentType("text/html"); |
27 |
PrintWriter out = response.getWriter(); |
PrintWriter out = response.getWriter(); |
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 |
|
|
32 |
try ( |
try ( |
33 |
Connection conn = DBConnection.getConnection(); |
Connection conn = DBConnection.getConnection(); |
34 |
Statement stmt = conn.createStatement() |
Statement stmt = conn.createStatement() |
35 |
) { |
) { |
36 |
|
|
37 |
stmt.executeQuery("SELECT 1"); |
out.print("Got DB Connection<br>"); |
38 |
|
|
39 |
|
stmt.executeQuery("SELECT 1"); |
40 |
|
|
41 |
|
out.print("'SELECT 1' query ok"); |
42 |
|
|
|
out.print("Got DB Connection"); |
|
43 |
|
|
44 |
} catch (SQLException e) { |
} catch (SQLException e) { |
45 |
out.print("DB Connection failed: " + e.getMessage()); |
out.print("DB Connection failed: " + e.getMessage()); |