File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes How to get details of a particular column in database. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JDBC
Reply Bookmark "How to get details of a particular column in database." Watch "How to get details of a particular column in database." New topic
Author

How to get details of a particular column in database.

Veena Gupta
Greenhorn

Joined: Oct 03, 2005
Posts: 4
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
Posts: 13

. . .
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
Posts: 381
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
Posts: 381
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
Posts: 4
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
Posts: 3
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>
 
 
subject: How to get details of a particular column in database.
 
MyEclipse, The Clear Choice