File file = new File("F://test.xls"); Connection conn = getConnection(); Statement st = null; try { st = conn.createStatement(); } catch (SQLException e2) { e2.printStackTrace(); } Workbook wb; try { wb = Workbook.getWorkbook(file); Sheet sheet = wb.getSheet(0); for (int i = 0; i < sheet.getRows(); i++) { String name = sheet.getCell(0, i).getContents(); String pwd = sheet.getCell(1, i).getContents(); String sql = "insert into login values('','" + name + "','" + pwd + "')"; try { st.executeUpdate(sql); } catch (SQLException e) { e.printStackTrace(); } } } catch (BiffException e1) { e1.printStackTrace(); }