/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package javaapplication2; import java.sql.Connection; import java.sql.DriverManager; import java.util.ArrayList; /** * * @author scottjf */ public class MainApp { /** * @param args the command line arguments */ public static void main(String[] args) { Connection connection = null; ArrayList testers = new ArrayList(); //connect to the database try { Class.forName("org.mariadb.jdbc.Driver").newInstance(); connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root1", "root1"); //multiple clients (windows) will use this connection to get unique callable statements. connection.setAutoCommit(true); } catch (Exception ex) { ex.printStackTrace(); } //create multiple instances of the class that makes calls to stored procedures //depending on the speed of the processor, the count may need to increase for(int i=0; i<5 ;i++){ testers.add(new ProcedureExecuter(connection,i)); } int count=0; //loop through each class and start it off for(final ProcedureExecuter temp: testers){ final int counter = count++; //needs to be threaded off to simulate multiple windows recieving an event to save their data Thread thread = new Thread(new Runnable(){ @Override public void run() { temp.startTest(counter); } }); thread.start(); } } }