title: netbeans DataBase retrieve data and display it another jframe textfield
body: <p>i want to retrieve my data and i want to display it another jframe . how to pass values to that point . </p>
  
  <pre><code>public void connectDb() {
      try {
          //setting up driver for Java Derby - select the Driver Class from connection properties
          Class.forName("org.apache.derby.jdbc.ClientDriver");
  
          //setting up Database connection through DriverManager.getConnection(dbUrl, DBusername, DBpwd)
          con = DriverManager.getConnection(
                          "jdbc:derby://localhost:1527/dbshop", //DB URL from connection properties
                          "apiit", //DB username you gave when creating db
                          "apiit");   //DB password you gave when creating db
  
          //create java.sql.Statement from db connection to execute SQL queries
          stmt = con.createStatement();
      } catch (ClassNotFoundException ex) {
  
      } catch (SQLException ex) {
          System.out.println("Error in file");
      }
  }//end connectDb()
  
  public void updatePassword(String u) {
      boolean flag = false;
      try {
  
          //Sql UPDATE         column name   tabl name             clmn          equlng vrbl
          String sql = "select lastname from CUSTOMERDETAILS where FIRSTNAME='" + u + "'";
  
          //if the update query was successful it will return the no. of rows affected
          ResultSet rs = stmt.executeQuery(sql);
          System.out.println(sql);
      } catch (SQLException ex) {
          System.out.println("Error in updatePasswrd");
      }
      // return flag;
  }
  </code></pre>