exo9: fixlets to the MySQL connection.
[TD_webapps.git] / ROOT / exo9 / connectJspMysql.jsp
CommitLineData
86398330
JB
1<%@ page import="java.io.*, java.util.*, javax.servlet.*, java.sql.*" %>
2<%
3
4try {
714e1b91 5 String connectionURL = "jdbc:mysql://localhost/MyBd";
86398330
JB
6 Connection connection = null;
7 Class.forName("com.mysql.jdbc.Driver").newInstance();
714e1b91 8 connection = DriverManager.getConnection(connectionURL, "MyBd", "MyBd");
86398330
JB
9 if(!connection.isClosed())
10 out.println("Successfully connected to " + connectionURL + " MySQL server using TCP/IP");
11 connection.close();
12 } catch (Exception e){
13 out.println("Unable to connect to database: " + e);
14 }
15
16%>