Uploaded image for project: 'ServiceMix'
  1. ServiceMix
  2. SM-785

Error in method doGetIds in DefaultJDBCAdapter class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0
    • 3.1
    • None
    • None
    • Jboss 4.0.3 SP1

    Description

      Hello the class DefaultJDBCAdapter have a littel error.
      in doGetids method you put :

      DefaultJDBCAdapter.java
        public String[] doGetIds(Connection connection) throws SQLException, IOException {
              PreparedStatement s = null;
              ResultSet rs = null;
              try {
                  List ids = new ArrayList();
                  s = connection.prepareStatement(statements.getFindAllIdsStatement());
                  rs = s.executeQuery();
                  while (!rs.next()) {                                 // <---------- ERROR
                      ids.add(rs.getString(1));
                  }
                  return (String[]) ids.toArray(new String[ids.size()]);
              }
              finally {
                  close(rs);
                  close(s);
              }
          }
      
      

      but this have a error, because when i execute query never i will added the content. The correct is:

      DefaultJDBCAdapter.java
        public String[] doGetIds(Connection connection) throws SQLException, IOException {
              PreparedStatement s = null;
              ResultSet rs = null;
              try {
                  List ids = new ArrayList();
                  s = connection.prepareStatement(statements.getFindAllIdsStatement());
                  rs = s.executeQuery();
                  while (rs.next()) {                                 // <---------- OK
                      ids.add(rs.getString(1));
                  }
                  return (String[]) ids.toArray(new String[ids.size()]);
              }
              finally {
                  close(rs);
                  close(s);
              }
          }
      
      

      This is a simple path

      Thanks:

      Attachments

        Activity

          People

            gnodet Guillaume Nodet
            junglika Jorge Rodríguez Pedrianes
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: