I am trying to write a java program that reads information from a database and creates a new stream for each table row. Therefore, I do not know how many threads I will need. while I have it:
con = DriverManager.getConnection(url, user, passwd); pst = con.prepareStatement("select hostname, ipadress, vncpassword from infoscreens"); rs = pst.executeQuery(); int i=0; while (rs.next()) { i++; Thread tread[i] = new Savescreenshots(rs.getString(1),rs.getString(3),rs.getString(2)); tread[i].start(); }
but the problem is that this does not work. I need the ability to create a new thread for each row in the table. dose anyone has an idea how to do this
thanks and greetings
source share