Advertisement
Guest User

Untitled

a guest
Oct 11th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. import java.io.File;
  2. import java.sql.Connection;
  3. import java.sql.DriverManager;
  4. import java.sql.PreparedStatement;
  5. import java.util.List;
  6. import java.util.Objects;
  7. import java.util.stream.Collectors;
  8. import java.util.stream.Stream;
  9.  
  10. public class App {
  11. private static Connection c;
  12.  
  13. public static void updateXml(String nom) throws Exception {
  14. Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
  15. c = DriverManager.getConnection("jdbc:oracle:thin:@oracle.fil.univ-lille1.fr:1521:filora","vanmarcke","azerty");
  16. PreparedStatement ps = c.prepareStatement("update candidats set cv = ? where nom in (Select nom from bossut.m12018 where username = ?)");
  17. File f = new File("C:\\Users\\ixpub\\Downloads\\CV");
  18. ps.setString(1,f+"\\"+nom+".xml");
  19. ps.setString(2,nom);
  20. ps.executeQuery();
  21. }
  22.  
  23. File f = new File("C:\\Users\\ixpub\\Downloads\\CV");
  24. List<String> listXMLFile = Stream.of(Objects.requireNonNull(f.listFiles())).map(File::getName).collect(Collectors.toList());
  25.  
  26. public static void main(String [] args) throws Exception {
  27. File f = new File("C:\\Users\\ixpub\\Downloads\\CV");
  28. List<String> listXMLFile = Stream.of(Objects.requireNonNull(f.listFiles())).map(File::getName).collect(Collectors.toList());
  29. for (String xml:listXMLFile) {
  30. //System.out.println(xml.substring(0, xml.length()-4));
  31. updateXml(xml.substring(0, xml.length()-4));
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement