Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try(FileWriter writer = new FileWriter("D:\\Worker.txt", false)){
- String fileName = "D:\\Worker.txt";
- File file = new File(fileName);
- FileInputStream fis = new FileInputStream(file);
- Class.forName("com.mysql.jdbc.Driver");
- Connection conn = DriverManager.getConnection(
- "jdbc:mysql://localhost:1234/sklad","root","1234");
- String pstmt = ("select * from EmployeeInfo");
- Statement s = conn.createStatement();
- s.executeQuery (pstmt);
- ResultSet rs;
- rs = s.getResultSet();
- while (rs.next ()){
- writer.write(resultSetToTableModel(rs));
- writer.append('\n');
- writer.append('E');
- writer.flush();
- }
- rs.close ();
- s.close ();
- }catch(Exception e1){
- System.out.println(e1.getMessage());
- }
- }
- });
Add Comment
Please, Sign In to add comment