title: REST server connect to databse and fetch data
body: <p>I'm new to JAVA and web services.</p>
  
  <p>I want to call a method in REST client JAVA Desktop application. Client is in NetBeans IDE and it should be something like a framework, where it calls the REST server (A dynamic web project), Server is in Eclipse IDE, it is also something like a framework - simple to change as user needs. Server should connect to MS SQL database to fetch data and pass that data to client and display those values in relevant text box in client desktop Application.
  REST client code to get the <code>JTextField</code> value.</p>
  
  <pre><code> String id = this.jTextField1.getText();
   ObjectMapper mapper = new ObjectMapper();
          try {
                mapper.writerWithDefaultPrettyPrinter().writeValueAsString(id);
          } catch (JsonProcessingException ex) {
              Logger.getLogger(SearchOne_1.class.getName()).log(Level.SEVERE, null, ex);
          }
  </code></pre>
  
  <p>When I click the button, I want to pass that text field value to REST server.
  That part of the code not yet implemented and still finding a way to do it.</p>
  
  <p>REST server code is like this.
  This is <code>SQLtask.java</code> .This is for select query.</p>
  
  <pre><code>    public SQLTasks(String dbSource) {
      super(dbSource);
  }
  public void SQLSelect(String SQL_SELECT) throws SQLException {
  
    try{
      stmt = conn.createStatement();  //connection created in MDBConnection class
      rs = stmt.executeQuery(SQL_SELECT);
    }
    catch(SQLException sqEx){
         System.out.println("SQL_EX "+sqEx);
         System.out.println("SQL_EX SELECT "+SQL_SELECT);
         throw new SQLException();
  
    }catch(Exception sqEx){
         System.out.println("EXC "+sqEx);
         System.out.println("EXC SELECT "+SQL_SELECT);
         throw new SQLException();
    }
  }
  </code></pre>
  
  <p>This code is for <code>DBAccess.java</code></p>
  
  <pre><code>public Employee getEmployeeDataByEPFNo(String dataSource,String EPFNo){
      SQLTasks st1 = new SQLTasks(dataSource);
      Employee employee=new Employee();
      try {
          st1.SQLSelect("SELECT * FROM Employee WHERE id="+EPFNo);
             ResultSet rs1 = st1.rs;
              while (rs1.next()) {
  
  
                  employee.setEpfno(rs1.getString("EPFNo"));
                  employee.setEfname(rs1.getString("fName"));
                  employee.setElname(rs1.getString("lName"));
                  employee.setDesignation(rs1.getString("designation"));
                  employee.setNic(rs1.getString("NIC"));
                  employee.setAddress(rs1.getString("Address"));
                  employee.setArrival(rs1.getString("eArrivalDate"));
                  employee.setDob(rs1.getString("DOB"));
  
              }
      } catch (SQLException e) {
  
          e.printStackTrace();
      }catch (Exception e) {
  
          e.printStackTrace();
      }
   return employee;
  }
  </code></pre>
  
  <p>this is <code>RESTServer.java</code></p>
  
  <pre><code>@GET
   @Path("/dbAccess/getDBValEmpByEPF/{EPFNo}")
   @Produces(MediaType.APPLICATION_JSON)
  
   public Employee getDBValEmpByEPF(@PathParam("EPFNo") String EPFNo) {
       Employee e= new Employee();
      DBAccess dbAcc=new DBAccess();
      e= dbAcc.getEmployeeDataByEPFNo("jdbc/db_sample_mssql","EPFNo");//call getEmployeeDataByEPFNo() which is inside DBAccess class
      return e;
  
  
      }
  </code></pre>
  
  <p>Instead manualy entering value as "500", what I want is pass that value getting from client. is it possible ? </p>