Guest User

Untitled

a guest
Feb 11th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.ResultSet;
  4. import java.sql.Statement;
  5. import java.text.SimpleDateFormat;
  6. import java.util.Date;
  7.  
  8. class Sample
  9. {
  10. public static void main(String args[])
  11. {
  12. MyThread1 thread1 = new MyThread1();
  13. thread1.start();
  14. }
  15. }
  16. class MyThread1 extends Thread
  17. {
  18. public void run()
  19. {
  20. try{
  21. while(true)
  22. {
  23. Class.forName("com.mysql.jdbc.Driver");
  24.  
  25. //Connection1
  26. Connection con=DriverManager.getConnection("jdbc:mysql://45.55.190.145/ems","dinesh","eee@kcg2017");
  27. Statement stmt=con.createStatement();
  28.  
  29. System.out.println(con);
  30. randomWait();
  31. }
  32. }catch(Exception e){ System.out.println(e);}
  33. }
  34.  
  35.  
  36. void randomWait()
  37. {
  38. try {
  39. sleep((long)(1000*60*60));
  40. } catch (InterruptedException x) {
  41. System.out.println("Interrupted!");
  42. }
  43. }
  44.  
  45. }
Add Comment
Please, Sign In to add comment