aspose 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


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » 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>
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to get details of a particular column in database.
 
Similar Threads
Columns on JTable
Problem in getSQLXML() method of ResultSet API
What is -Xlint in compiling java program?why this is done?
pulling the table names from a Database
Tryin' to create a small MS SQL Java Application