ResultSet incorrect only with TYPE_SCROLL_INSENSITIVE, CONCUR_READ_ONLY
<p>I have a simple piece of code I have been working on :</p>

<pre><code>import java.sql.*;

class ODBC  
{
MyConnection myCon;
Connection jdbcConnection;
ResultSet rs;
String sql;
PreparedStatement stmt;

public ODBC() throws Exception {
    init();
}

public void init() throws Exception{
    myCon = new MyConnection();     
    jdbcConnection = myCon.getConnection();
}

public void runQuery() throws SQLException {
    sql = "SELECT DISTINCT HELPDESK_CASE.INCIDENT_NUMBER, "
            + "HPD_AUDIT.AUDIT_DATE, HPD_AUDIT.AUDIT_FIELD, "
            + "HELPDESK_CASE.DETAILED_DESCRIPTION, "
            + "HPD_AUDIT.AFTER_VALUE, "
            + "HELPDESK_CASE.DESCRIPTION "
            + "FROM HELPDESK_CASE INNER JOIN "
            + "HPD_AUDIT ON HELPDESK_CASE.INCIDENT_NUMBER "
            + "= HPD_AUDIT.INCIDENT_NUMBER "
            + "WHERE (((HELPDESK_CASE.INCIDENT_NUMBER)='INC001001837949') "
            + "AND ((HPD_AUDIT.AUDIT_FIELD)='Assigned Group')) "
            + "ORDER BY HELPDESK_CASE.INCIDENT_NUMBER, "
            + "HPD_AUDIT.AUDIT_DATE"; 
    stmt = jdbcConnection.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE );
    rs = stmt.executeQuery();
    while(rs.next()){
        System.out.println("Something is here");
    }
}

public static void main (String args[]) throws Exception 
{
    ODBC odbc;
    odbc = new ODBC();
    odbc.runQuery();
}

class MyConnection {
    public Connection getConnection() throws Exception 
    {
        String URL = "jdbc:odbc:corpp05";
        Connection c = DriverManager.getConnection(URL, "remro", "*****"); 
        return c;
    }
}
}
</code></pre>

<p>I cannot figure out the following behavior.</p>

<ol>
<li>I run this query in MySQL as well as Access using the same JDBC driver and they return nothing (as they should return NOTHING as the incident number being queried does not exist).</li>
<li>I need the ability in other areas of this program (outside of this sample snip) to call <em>resultSet.previous() resultSet.beforeFirst()</em> etc. and therefor need to be able to SCROLL forwards and backwards.</li>
<li><p>When I use the preparedStatement as follows:</p>

<p><em>stmt = jdbcConnection.prepareStatement(sql);</em></p></li>
</ol>

<p>The while loop is never executed as is expected behavior but when I use the preparedStatement as follows:</p>

<pre><code>stmt = jdbcConnection.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE );
</code></pre>

<p>(Which I need since I need the TYPE_SCROLL_INSENSITIVE) The while loop IS executed and "Something is here" is printed.</p>

<p>What am I missing here? I feel like it is relatively obvious I need to just take a step back and have other eyes on this I believe. Appreciate the help.</p>

<p>Cmres</p>
