当想要将utf-8插入mysql数据库时,jdbc不提供事实值。给了??????
<%
String conUrl="jdbc:mysql://localhost:3306/school1?useEncoding=true&characterEncoding=UTF-8";
String userName="root";
String pass="system";
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(conUrl,userName,pass);
String firstname = new String(request.getParameter("fName").getBytes("ISO-8859-1"),"UTF-8");
String email = new String(request.getParameter("eMail").getBytes("ISO-8859-1"),"UTF-8"); System.out.print(firstname);
System.out.print(email);
try {
st.executeUpdate("insert into std values('"+firstname+"','"+email+"')");
}
catch(Exception e1) {
System.out.print(e1);
} %>