从键盘键入String类型的数据插入数据库中,为什么乱码?
											输入中文就乱码,eclipse默认编码格式是utf-8,数据库也是utf-8这是代码
 程序代码:
程序代码:
//从这里输入数据
    Date time = new Date(System.currentTimeMillis());
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String date = sdf.format(time);
    String project = Input.getProject(s);
    String in_money = Input.getIn_money(s);
    String out_money = Input.getOut_money(s);
    Account a = new Account();
    a.setDate(date); 
    a.setProject(project);
    a.setIn_money(in_money);
    a.setOut_money(out_money);
    Account account = new Account(date, project, in_money, out_money);
    account.printAccountInfo();
    boolean confirm = Input.getConfirm(s);
    if (confirm) {
        accountOperation.insertAccount(account);
    }
//把数据插入数据库中
public void insert_DB(Account account) throws ClassNotFoundException, SQLException {
        // 获得连接
        Connection conn = JDBCUtil.getConnection();
        // 发送语句
        String sql = "insert into account(date,project,in_money,out_money) value(?,?,?,?)";
        PreparedStatement pstmt = conn.prepareStatement(sql);
        pstmt.setString(1, account.getDate());
        pstmt.setString(2, account.getProject());
        pstmt.setString(3, account.getIn_money());
        pstmt.setString(4, account.getOut_money());
        pstmt.executeUpdate();
        //System.out.println(account.getProject());
        // 关闭连接
        JDBCUtil.closeResource(pstmt, conn);
    }
										
					
	


 
											





 
	    

 
	



 ,谢谢
,谢谢