X-Git-Url: https://git.piment-noir.org/?p=TD_webapps.git;a=blobdiff_plain;f=ROOT%2Fexo9%2FconnectJspMysql.jsp;fp=ROOT%2Fexo9%2FconnectJspMysql.jsp;h=8d0f0827184ff053a095bed1d35aee1dc9885837;hp=0000000000000000000000000000000000000000;hb=8639833058a983de10b1571c8f99c8d01e793804;hpb=e17ad78fbbde71fd9615a744b857b79a692587de 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); + } + +%>