Author
How to get details of a particular column in database.
Veena Gupta
Greenhorn
Joined: Oct 03, 2005
Messages: 4
posted Nov 10, 2005 10:54:00
Hi dear friends, I am getting error while i try to get index information on a particular column. here is the code.. why it gives me error it give error SQL Exception: Invalid cursor state why? thanks a lot Veena [ November 10, 2005: Message edited by: Veena Gupta ]
Deepak Kaul
Greenhorn
Joined: Nov 08, 2005
Messages: 13
posted Nov 10, 2005 14:34:00
. . . indexList.next(); while(indexList.next()) . . .
If there is only 1 row in the result set then by the time you try to get the data out from the resultset it has already reached the end
Maximilian Xavier Stocker
Ranch Hand
Joined: Sep 20, 2005
Messages: 381
posted Nov 10, 2005 16:57:00
The problem is when you get your result set called columns you do not advance the cursor before you call getString on it. After the line You need a or something in there. You should probably check that the columns cursor has actually a row in it.
Maximilian Xavier Stocker
Ranch Hand
Joined: Sep 20, 2005
Messages: 381
posted Nov 10, 2005 16:59:00
Originally posted by Deepak Kaul: If there is only 1 row in the result set then by the time you try to get the data out from the resultset it has already reached the end
That is also a bug that needs to be fixed but it is not causing the problem the user is describing here.
Veena Gupta
Greenhorn
Joined: Oct 03, 2005
Messages: 4
posted Nov 10, 2005 20:39:00
Thanks all for such quick help. Rather thanking is not sufficient . I shall try to help others in the same spirit. Thanks a lot Veena
Cosmo Haun
Greenhorn
Joined: Oct 14, 2005
Messages: 3
posted Nov 13, 2005 06:31:00
The codefetch query sql list indexes brings up this example code for printing a list of indexes of a table in a database from the book Java Enterprise in a Nutshell
Find example source code written by java book authors at <a href="http://java.codefetch.com" target="_blank" rel="nofollow">http://java.codefetch.com</A>