سؤال

I'm trying to read from a mySQL server (in my LAN) a huge resultSet. I implemented it the way I found looking for the setFetchSize method: BalusC's Example. So I did:

        con = DriverManager.getConnection(url, user, password);

        //con.setAutoCommit(false);
        st = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        st.setFetchSize(Integer.MIN_VALUE);
        rs = st.executeQuery(query);

        int count = 0;
        while (rs.next ()) {                
            // Process entry
            String rsc = rs.getString ("resource");
            String tpc = rs.getString("topic");   
            System.out.println(count + ": " + rsc); 
            ++count;                
        }

Although, it hangs at row 1077 at the line rs.next(). It doesn't throw exception.

EDIT:

After a timeout something new happened. It returned this error message:

JDWP exit error JVMTI_ERROR_NONE(0): getting frame location [../../../src/share/back/stepControl.c:641]

This error seems to be unrelated.

EDIT2: I've coded a PHP script for retrieving results by stream and happens exactly the same. So it has nothing to do with JDBC... I don't know what is going on!!

هل كانت مفيدة؟

المحلول 2

OKay, the problem was at the query itself.

I've found that streaming is very sensitive on how query is built. If I make a little change (like adding SELECT DISTINCT) it buffers or hangs. Finally, I left a column out of the query and worked...

نصائح أخرى

The second error message is a deadlock in the Eclipse debugger when hot-swapping and/or JRebel (source):

It is a known problem, actually two problems.
1) Eclipse debugger deadlocks sometimes on hot-swapping (true for any version of JRebel).
2) JVM crash on hotswapping - it is true for JRebel 4M1.

We are expecting bugfix release soon (3.6.2 together with Eclipse plugin) - It will fix first problem. Second problem should be fixed with 4M2 release.

Suggestions:

  1. Update Eclipse to 3.7.2 and JRebel to the latest release
  2. Start the application again.
  3. Use logging/System.out.println() to debug
  4. Check the log of your mysql server for problems (harddisk, network)
  5. Run the query in a SQL workbench (to see whether this is a problem in the query/the server or your code)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top