使用struts1做得一個注冊系統。為什么中文寫入數據庫是亂碼???獲取連接的方法:public static Connection getCon() { Connection con=null; try { Class.forName("com.mysql.jdbc.Driver"); String url="jdbc:mysql://localhost:3306/struts1?user=root&password=1997520"; con=DriverManager.getConnection(url); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return con; }需要設置數據庫編碼么?
添加回答
舉報
0/150
提交
取消