IntelliJ open source
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JDBC
 
RSS feed
 
New topic
Author

How to get details of a particular column in database.

Veena Gupta
Greenhorn

Joined: Oct 03, 2005
Messages: 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
Messages: 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
Messages: 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
Messages: 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
Messages: 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
Messages: 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>
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JDBC
 
RSS feed
 
New topic
replay challenge