Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.Statement;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- class Sample
- {
- public static void main(String args[])
- {
- MyThread1 thread1 = new MyThread1();
- thread1.start();
- }
- }
- class MyThread1 extends Thread
- {
- public void run()
- {
- try{
- while(true)
- {
- Class.forName("com.mysql.jdbc.Driver");
- //Connection1
- Connection con=DriverManager.getConnection("jdbc:mysql://45.55.190.145/ems","dinesh","eee@kcg2017");
- Statement stmt=con.createStatement();
- System.out.println(con);
- randomWait();
- }
- }catch(Exception e){ System.out.println(e);}
- }
- void randomWait()
- {
- try {
- sleep((long)(1000*60*60));
- } catch (InterruptedException x) {
- System.out.println("Interrupted!");
- }
- }
- }
Add Comment
Please, Sign In to add comment