How to convert resultset into int for query
<p>I am fetching data from "1st table" and storing it into resultsset. Now I want to insert the fetched data into "2nd table"</p>

<p>The problem is that "2nd table" only takes int values.</p>

<p>I tried:</p>

<pre><code>while (rs.next()) 
    {
        int g = rs.getInt(1);
    }
</code></pre>

<p>and </p>

<pre><code>    int g = Integer.parseInt(rs);
</code></pre>

<p>but it's giving me error <code>java.lang.NumberFormatException</code> for input string: <code>"com.mysql.jdbc.ResultSet@39badcaa"</code></p>
