title: How to SELECT using Stored Procedure
body: <p>How can I retrieve (SELECT) all my data using Stored Procedure while using this Stored Procedure via Callable Statement? I created a sample project where I need to <strong>SELECT</strong> all the data from my table. First I used a Prepared Statement so I can insert data to the following textfields. Btw I'm using derby.</p>
  
  <p><strong>TABLE</strong></p>
  
  <pre><code>CREATE TABLE SAMPLEONLY
  (
  FULLNAME VARCHAR(50),
  ADDRESS VARCHAR(50)
  )
  </code></pre>
  
  <p><strong>GUI</strong></p>
  
  <p><a href="https://i.stack.imgur.com/IXAz8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IXAz8.png" alt="SAMPLE"></a></p>
  
  <p><strong>CODES FOR INSERT</strong></p>
  
  <pre><code>    private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {                                          
      String addFullname = fullnameTf.getText();
      String addAddress = addressTf.getText();
  
  
      String insert = "INSERT INTO SAMPLEONLY (FULLNAME,ADDRESS) VALUES (?,?)";
      try (Connection myConn = DriverManager.getConnection(url, user, pass);
          PreparedStatement myPs = myConn.prepareStatement(insert);){
  
          myPs.setString(1, addFullname);
          myPs.setString(2, addAddress);
  
          myPs.executeUpdate();
  
  
      } catch (SQLException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>After inserting to the following textfields. I need to retrieve all my data using Stored Procedure. I created a stored procedure base on what I read on Derby Reference Manual. How can insert SELECT * FROM SAMPLEONLY in my Stored Procedure?</p>
  
  <p><strong>STORED PROCEDURE</strong></p>
  
  <pre><code>CREATE PROCEDURE show_data(IN FULLNAME VARCHAR(50), IN ADDRESS VARCHAR(50))
  PARAMETER STYLE JAVA
  LANGUAGE JAVA
  READS SQL DATA
  EXTERNAL NAME 'Frame.searchButton'
  //HOW CAN I INSERT HERE?
  </code></pre>
  
  <p>How can I insert the SELECT * FROM SAMPLEONLY here? I'm a little bit confused creating this stored procedure because this is my first time to use this. I named my class as Frame</p>
  
  <p><strong>CODE FOR SELECT</strong></p>
  
  <pre><code>private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {                                             
      String seeachStoredProc = "{call show_data(?,?)}";
  
      try (Connection myConn = DriverManager.getConnection(url, user, pass);
           CallableStatement myCs = myConn.prepareCall(seeachStoredProc);)
          {
  
                  //what goes here?
  
          } 
      catch (SQLException e) 
      {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>Any help will appreciate! Guide me if something wrong in my codes. Feel free to comment.</p>