Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Strange problem: JDBC: Oracle Connection: Cursor hangs in ResultSet

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My program connects to an oracle db and queries all records (480'000) from a table with 4 columns (of which one, Z00_DATA, is of type LONG (and on average is about 1000 chars long)).

From my Windows machine, the program runs fine.

From a linux box the same program doesn't: it executes the statement, but when I skim through the returned resultset (even if I only count the number of records in it, it gets stuck on record 80. No exception thrown (I'm catching a general Exception object), it just hangs.

[[ while (rs.next) { counter++; System.out.println(counter);} ]]

When I change my query slightly and select only 3 columns (all except the LONG one), it runs fine again.

This seems very odd to me since I'm not even reading the data inside the resultSet. (I will later, I'm just debugging now).

Here's the code, if anyone can, please help.

Charlie

-------------------



[edited to add code tags]
[ November 22, 2004: Message edited by: Jeanne Boyarsky ]
 
author & internet detective
Posts: 40746
827
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Charles,
Welcome to JavaRanch!

I'm not sure why it is hanging at that point. It wouldn't matter if you are accessing the columns though. JDBC has to transfer to whole row to your machine, even if you ignore it. That's why it is recommended to only select the columns you are going to use. (I'll assume you are going to use all the columns later though.)

Is there any other database activity going on while you try this? Maybe someone has a lock on part of the result?
 
Charles Foetz
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply, Jeanne.

Yes I need all the columns. There is probably some access to the database, much rather than changing the rows I'm getting stuck on, new rows are being added. For a given query it always hangs at the same row,

i.e. normally record 80 / 480.000

If I query all records where recordID isn't 80, it gets stuck at 79.
If I query all records where recordID > 100, it goes up to something like 160.

The data in the row that makes it get stuck is nothing too different from data in other rows. I suspect something to do with a full heap or buffer, Java internally.

What I really don't get is that it runs fine on my windows machine, but not on the Linux one. Other queries (on other tables) run fine on both machines. Only for this very table the problem occurs, and only if the query includes this Z00_DATA column, of type LONG. And how can it just hang, rather than giving me an exception?

Charlie
 
Charles Foetz
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried using the oci driver instead of thin, also tried using older oracle classes (classes12 and classes111 instead of ojdbc14), doesn't change a thing :-(
Charlie
 
reply
    Bookmark Topic Watch Topic
  • New Topic