Hi, I am trying to get data in two result sets. then I have a repository in both result sets in a String Array, after this process I have to save the String array in another table, as you so kindly tell me.
try { Class.forName("com.mysql.jdbc.Driver"); Connection con = (Connection) DriverManager. getConnection("jdbc:mysql://localhost:3306/lportal", "root", "ubuntu123"); PreparedStatement stmt = (PreparedStatement) con. prepareStatement("SELECT * FROM Testi_Testimonial where subject = ?"); stmt.setString(1, search); stmt.execute(); rs = (ResultSet) stmt.getResultSet(); while (rs.next()) { anArray[i] = rs.getString("subject"); System.out.println(anArray[i]); i++; count++; } PreparedStatement stmt1 = (PreparedStatement) con. prepareStatement("SELECT * FROM Testi_Testimonial where subject != ?"); stmt1.setString(1, search); stmt1.execute(); rs1 = (ResultSet) stmt1.getResultSet(); while (rs1.next()) { anArray[i] = rs1.getString("subject"); System.out.println(anArray[i]); i++; count++; } } catch (Exception e) { e.printStackTrace(); System.out.println("problem in connection"); }
Please tell me how can I save my array in a Temp table? my table "Temp" has a subject column. I want to save myArray column to subject ... kindly tell me how to do this.
source share