Advertisement
Guest User

Untitled

a guest
Sep 10th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. public static class mysql implements ActionListener{
  2. ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
  3. ScheduledFuture<?> future = executor.scheduleWithFixedDelay(() -> actionPerformed(null), 1, 1, TimeUnit.MINUTES);
  4.  
  5. private static String url = "jdbc:mysql://";
  6. private static String user = "";
  7. private static String password = "";
  8.  
  9.  
  10.  
  11. private static Connection con;
  12. private static Statement stmt;
  13.  
  14. public void actionPerformed(ActionEvent e){
  15.  
  16.  
  17. try {
  18. ownip = Getip.getip();
  19. gettime = Gettime.getip();
  20. } catch (IOException e1) {
  21.  
  22. e1.printStackTrace();
  23. return;
  24. }
  25.  
  26. StringBuilder lp = List.list();
  27. try {
  28.  
  29.  
  30. con = DriverManager.getConnection(url, user, password);
  31. stmt = con.createStatement();
  32. String sql = "zapros";
  33.  
  34. PreparedStatement preparedStatement = con.prepareStatement(sql);
  35.  
  36. preparedStatement.executeUpdate();
  37.  
  38. } catch (SQLException sqlEx) {
  39. sqlEx.printStackTrace();
  40. }
  41.  
  42. }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement