From: Jérôme Benoit <jerome.benoit@piment-noir.org>
Date: Wed, 11 Apr 2018 14:45:29 +0000 (+0200)
Subject: Add exo9 code.
X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=8639833058a983de10b1571c8f99c8d01e793804;p=TD_webapps.git

Add exo9 code.

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
---

diff --git a/ROOT/exo9/META-INF/context.xml b/ROOT/exo9/META-INF/context.xml
new file mode 100644
index 0000000..00e2ff6
--- /dev/null
+++ b/ROOT/exo9/META-INF/context.xml
@@ -0,0 +1,2 @@
+<Context path=""
+	antiResourceLocking="false" />
diff --git a/ROOT/exo9/WEB-INF/lib/mysql-connector-java.jar b/ROOT/exo9/WEB-INF/lib/mysql-connector-java.jar
new file mode 100644
index 0000000..d72973e
Binary files /dev/null and b/ROOT/exo9/WEB-INF/lib/mysql-connector-java.jar differ
diff --git a/ROOT/exo9/connectJspMysql.jsp b/ROOT/exo9/connectJspMysql.jsp
new file mode 100644
index 0000000..8d0f082
--- /dev/null
+++ b/ROOT/exo9/connectJspMysql.jsp
@@ -0,0 +1,16 @@
+<%@ page import="java.io.*, java.util.*, javax.servlet.*, java.sql.*" %>
+<%
+
+try {
+    String connectionURL = "jdbc:mysql://localhost/bdVols";
+    Connection connection = null;
+    Class.forName("com.mysql.jdbc.Driver").newInstance();
+    connection = DriverManager.getConnection(connectionURL, "fraggle", "$Love79!");
+    if(!connection.isClosed())
+        out.println("Successfully connected to " + connectionURL + " MySQL server using TCP/IP");
+    connection.close();
+    } catch (Exception e){
+            out.println("Unable to connect to database: " + e);
+    }
+
+%>