repositories
/
TD_webapps.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
exo10: add a FIXME comment.
[TD_webapps.git]
/
ROOT
/
exo9
/
connectJspMysql.jsp
diff --git
a/ROOT/exo9/connectJspMysql.jsp
b/ROOT/exo9/connectJspMysql.jsp
index 8d0f0827184ff053a095bed1d35aee1dc9885837..8ce40ed9faca33a3a97bdf9956fcec6240826ca3 100644
(file)
--- a/
ROOT/exo9/connectJspMysql.jsp
+++ b/
ROOT/exo9/connectJspMysql.jsp
@@
-1,16
+1,19
@@
<%@ page import="java.io.*, java.util.*, javax.servlet.*, java.sql.*" %>
<%
<%@ page import="java.io.*, java.util.*, javax.servlet.*, java.sql.*" %>
<%
+Connection connection = null;
try {
try {
- String connectionURL = "jdbc:mysql://localhost/bdVols";
- Connection connection = null;
+ String connectionURL = "jdbc:mysql://localhost/MyBd?useUnicode=yes&characterEncoding=UTF-8";
Class.forName("com.mysql.jdbc.Driver").newInstance();
Class.forName("com.mysql.jdbc.Driver").newInstance();
- connection = DriverManager.getConnection(connectionURL, "
fraggle", "$Love79!
");
+ connection = DriverManager.getConnection(connectionURL, "
MyBd", "MyBd
");
if(!connection.isClosed())
out.println("Successfully connected to " + connectionURL + " MySQL server using TCP/IP");
if(!connection.isClosed())
out.println("Successfully connected to " + connectionURL + " MySQL server using TCP/IP");
- connection.close();
} catch (Exception e){
} catch (Exception e){
- out.println("Unable to connect to database: " + e);
+ out.println("Unable to connect to database: " + e);
+ }
+ finally {
+ if (connection != null)
+ connection.close();
}
%>
}
%>