• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get details of a particular column in database.

 
Veena Gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

. . .
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
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic