title: Write arraylist to a database java
body: <p>I have two arraylists to insert into 2 columns in a database table as follows:</p>
  
  <pre><code>arraylist1: 123444, 324555, 6423643, 532326
  arraylist2: jkfdsl, nkjfsdlj, jdslkfjdlkj, jfsldjfsk, fjdlskjfs
  </code></pre>
  
  <p>I wrote the following code to insert the arraylists but it is not working.  I will appreciate your help.</p>
  
  <pre><code>try {
  // Prepare a statement to insert a record
  
  String sql = "INSERT INTO soundsdata.splog (arraylist1, arraylist2) VALUES(?,?)";
  pstmt = (PreparedStatement) con.prepareStatement(sql);
  
  pstmt.setArray(1,sptospring);
  pstmt.setString(2,eachList.toString());
  
  // Insert the row
  pstmt.executeUpdate();
  }finally {
  pstmt.close();
  }
  </code></pre>