aspose file tools*
The moose likes JDBC and the fly likes JDBC and non-indexed table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC and non-indexed table" Watch "JDBC and non-indexed table" New topic
Author

JDBC and non-indexed table

Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
Hello,
How would I handle ResultSet of a non-indexed table? Is it possible in JDBC to move thru ResultSet by memory location so I can distinguish between rows with same data?
thanks,
Alex


All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
Rudy Dakota
Ranch Hand

Joined: Jul 27, 2002
Posts: 54
Hi ALex,
Let me just chew on this for a while. A non-indexed table? Do I get you correctly to mean a table containing duplicate rows? If so, you can still index the table, but it will not be a uniqie index .
Anyways, I think you can easily get to a row's position in the ResultSet (getRowNum(), wasn't it). If you store that value with the other row data, you 'll always know what row you 're dealing with .
Good riding,
Rudy.
Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
Well, the reason the table is not indexed is because the table structure at my work is STUPID. But as you say if I am going to use getRowNum(), and try to delete record where more than one record is the same wouldn't it delete all the same records? Or should I just see if getRowNum() is more than 1 and delete any one of those?
Rudy Dakota
Ranch Hand

Joined: Jul 27, 2002
Posts: 54
Hi Alex,
Now that 's a different ball game, isn't it? Just now we were talking about browsing through a ResultSet, and already we 're out to delete records. That does require a bit more caution, obviously.
Clearly you 're on a very risky track if you try and delete a record that satisfies some criterion. There may be more than one, as you state. Some implementations of ResultSet allow you to delete given rows in the set, and commit this to the underlying database, but I never worked with it. I wouldn't know whether that 's a good solution or not. It seems to deal with your uniquiness problem, I would say.
Oh, by the way, I don't follow your remarks on the getRowNum() function. It seems you have a different idea of what it does. In this case I 'll join one of the regulars here in saying: 'Javadoc is your friend'. Stay late and you might meet him. He 's a bit talkative at times, but he might learn you a trick or two. Say hello from me when you meet him in the saloon.
Good riding,
Rudy.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC and non-indexed table