1 Reply Latest reply: Sep 22, 2008 9:08 AM by 843785 RSS

    DB connectivity using Oracle : (pls see code)

    800601
      LOCAL VARIABLE : ResultSet
      after closing the variable resultSet ,I am trying to reuse the same variable for the next query but it points it out as an error : SAYING DUPLICATE LOCAL VARIABLE . WHY ?

      Can anyone give me an explanation . I am new to Java .

      Class.forName(JDBC_DRIVER);
                     connection = DriverManager.getConnection(DATABASE_URL,"siw","abcdee");
                     statement = connection.createStatement();
                     
                     ResultSet resultSet = statement.executeQuery("SELECT pfi,opcert from pfi_opcert);
                     while(resultSet.next())
                     {
                          hash.put(resultSet.getString("pfi"), resultSet.getString("opcert"));
                     }
                     
                     resultSet.close();   -----------------------------------------------------------> after closing the variable resultSet ,I am trying to reuse the same variable for the next query but it ispoints it out as an error : SAYING DUPLICATE LOCAL VARIABLE . WHY ?
      
                     
                     ResultSet resultSet = statement.executeQuery("SELECT * from dual");
      
      
      
      
      
      
      
      {code}