retainAll not printing the values
<p>hi i am trying to get common values from two string lists... List A has a values obtained by querying the Excel database and List B has a values obtained by querying the SQL database. i want to have common values from A and B. for that i used retainAll collection. but it is not printing the common values.instead its giving me [ ]. please help me to solve this problem. how to get common values otherthan using retainAll. please correct my code snippet.</p>

<pre><code>      //connecting excel database and storing its values
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      conn=DriverManager.getConnection("jdbc:odbc:spreadsheetdb","","");
      out.println("Excel Database connected" +"&lt;br&gt;");

      Statement stmt=conn.createStatement();
      String excelquery="Select * from [Sheet1$]";
      ResultSet excelvalues= stmt.executeQuery(excelquery);

      List A= new  ArrayList();
      while(excelvalues.next()){
            A.add(excelvalues.getString("name"));}

   //connection sql Db and storing its values

   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
   connection = DriverManager.getConnection("jdbc:odbc:copyknowledgebase","sa","sqladmin");
   out.println("&lt;br&gt;"+"MSSQL connected " +"&lt;br&gt;")

   Statement statement=connection.createStatement();
   String conceptquery="Select * from dbo.conc";
   ResultSet conceptdetails=statement.executeQuery(conceptquery);
   Timestamp ts = new Timestamp(new java.util.Date().getTime());

  List B = new  ArrayList();
  while(conceptdetails.next()){
  B.add(conceptdetails.getString("Cname"));
  }
  B.retainAll (A);
  out.println(B);
</code></pre>
