Add exo9 code.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 11 Apr 2018 14:45:29 +0000 (16:45 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 11 Apr 2018 14:45:29 +0000 (16:45 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
ROOT/exo9/META-INF/context.xml [new file with mode: 0644]
ROOT/exo9/WEB-INF/lib/mysql-connector-java.jar [new file with mode: 0644]
ROOT/exo9/connectJspMysql.jsp [new file with mode: 0644]

diff --git a/ROOT/exo9/META-INF/context.xml b/ROOT/exo9/META-INF/context.xml
new file mode 100644 (file)
index 0000000..00e2ff6
--- /dev/null
@@ -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 (file)
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 (file)
index 0000000..8d0f082
--- /dev/null
@@ -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);
+    }
+
+%>