implement Restful webservice with mysql
<p>I want to do CRUD operation using restful web-services using java 
the program consumes xml and json and also produces xml and json format</p>

<p>if any one can give an example thanks
  resource class 
    enter code here</p>

<pre><code>@Path("/researcher/{id}")
@GET
@Produces("application/xml")
public Response getResearcherById(@PathParam("id") int id) {

    Researcher res = new Researcher();
    // XMLUnMarshaller unmarshaller = new XMLUnMarshaller();
    ResearcherBLL resBLL = new ResearcherBLL();
    Map rs = resBLL.getResearcherById(id);

    return Response.ok(rs).build();
    }

//this is business layer class
public Map getResearcherById(int id) {
    ResultSet rs = null;
    Researcher res = new Researcher();
    try {
        rs = res.getResearcherById(id);

        Map&lt;String, String&gt; getResearcherInfo = new HashMap&lt;String, String&gt;();
        java.sql.ResultSetMetaData rmd = rs.getMetaData();
        while (rs.next()) {
            for (int j = 1; j &lt;= rmd.getColumnCount(); j++) {
                getResearcherInfo.put(rmd.getColumnName(j), rs.getString(j));
            }
        }
       return getResearcherInfo;
    } catch (SQLException ex) {
        ex.printStackTrace();
    }

    return null;
}

//this is Data Access layer Class 

/**
 * retrieve existing researcher information from the database
 */
public ResultSet getResearcherById(int ResearcherId) throws SQLException {
    ConnectionBridge connection = new ConnectionBridge();

    ResultSet rs = null;
    PreparedStatement psRetrieveResearcher = null;
    String sqlselect = "select * from researcher where id=?";

    psRetrieveResearcher = connection.openConnection().prepareStatement(sqlselect);//exception occured here
    psRetrieveResearcher.setInt(1, ResearcherId);
    rs = psRetrieveResearcher.executeQuery();
    return rs;
}


    and it creates this Exception
    SEVERE: java.sql.SQLException
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
    at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:815)
    at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5528)
    at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5448)
    at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5488)
</code></pre>

<p>the connection works but somehow it can not access the data</p>
