Finish exo9 code and fix unicode support where possible.
[TD_webapps.git] / ROOT / exo9 / connectJspMysql.jsp
CommitLineData
86398330
JB
1<%@ page import="java.io.*, java.util.*, javax.servlet.*, java.sql.*" %>
2<%
3
d2793705 4Connection connection = null;
86398330 5try {
d2793705 6 String connectionURL = "jdbc:mysql://localhost/MyBd?useUnicode=yes&characterEncoding=UTF-8";
86398330 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");
86398330 11 } catch (Exception e){
d2793705
JB
12 out.println("Unable to connect to database: " + e);
13 }
14 finally {
15 if (connection != null)
16 connection.close();
86398330
JB
17 }
18
19%>