JDBCを使ってデータを挿入したい。私はこのコードを書きます:
//ここでスレッドを開始したい
      while(stmt_ver.next()){ 
        stmt_ver.setString(i, "test"+... ); 
        stmt_ver.executeBatch();
        connection_ver.commit(); 
}
//ここでスレッドを終了したい
スレッドでこれを行うにはどうすればよいですか?
JDBCを使ってデータを挿入したい。私はこのコードを書きます:
//ここでスレッドを開始したい
      while(stmt_ver.next()){ 
        stmt_ver.setString(i, "test"+... ); 
        stmt_ver.executeBatch();
        connection_ver.commit(); 
}
//ここでスレッドを終了したい
スレッドでこれを行うにはどうすればよいですか?
どうぞ。コードで回答を更新
ねじ込みクラス
public class MyThreadedClass extends Thread{
     //Do what I need here on a thread
     public void run(){
         //Do what I need here
     }
}
主要
//Main class
public static class MyProgramMain{
//Program main
public static void main(String[] args) {
                //Send 10 threads
        for (int i=0; i<10; i++){
                  //Init class (threaded)
                   MyThreadedClass threadedClass = new MyThreadedClass();
                   //Execute code in the class run() method
                   threadedClass.start();
            }
    }
}