This SQLException occurs when i call absolute mehtod and then getString method. for the first time the getString method retrieves the data but the next time it gives this Exception, let me clear u one thing that these two methods are called in ActionEvent of button and the ResultSet contains the same data.Pls reply soon with cause of error and its possible remedy as quicky as possible as i am running out of time.
If so, this is a fairly common problem where you cannot (for reasons beyond me) read the same attribute more than once. If this is what you are trying to do, Store the String in a variable and reuse it from there instead.
True, I have encountered the same problem. The getString(int col) when called on the same col,caused error when I used jdbc-odbc bridge. But when I used the Oracle JDBC Driver(oci driver) there was no problem. Hence I think it is the problem with the driver used. I don't know the reason. cheers Prashanth
Joined: Feb 24, 2001
thanks guys for ur reply but u misunderstood my problem. the problem udescribed and told the solution of was also faced by me i was resolved a week before in the way David told with the same resoning that he thinks. and in that case u get an SQLException : Invalid Descriptor Index. But my problem is SQLException :Function Sequence Error. Now when the the ADD button is clicked for the first time every thing goes in the it shuold but on the next time it gives error on the //line 2 it prints "After absolute row"+current row no. but not the second print statement and gives the error i told u. heres the code. Brief description of the objects and variables. //********** ADD is the button on which the code is called guicreator is my class which has a static connection object for whole of the application. client_rs is a ResultSet which is currently ie when the control is in the if construct hold the data from the client table of my database.
1 of 2 things may be happening here: 1. some drivers (including jdbc:odbc bridge) only allow you to read the columns as they appear in the query. Example, if you use the following as your query "select id, name from emp", you should perform the rs.getString("id") first, because the column is first in the query. After reading the first column, you can perform rs.getString("name"). If you try to read the name before reading id, you may get this error. 2. some drivers don't allow you to use rs.getString("column_name"), but only rs.getString(1) with an int parameter. try both because they both might be applicable to your driver (sounds finicky!) Jamie [ Edited by Dave to fix ] [ March 14, 2002: Message edited by: David O'Meara ]
an explanation by sun. "The ResultSet.getXXX methods provide the means for retrieving column values from the current row. For maximum portability with forward only result sets, values should be retrieved from left to right, and column values should be read only once"
Joined: Feb 24, 2001
Jamie u again answered what i do not want. i want SQLException: Funtion Sequence error.Pls read the code which i have given in the reply i have also given the briefing of the code so that u can better understand it.
Originally posted by rahul kumar: Jamie u again answered what i do not want. i want SQLException: Funtion Sequence error.Pls read the code which i have given in the reply i have also given the briefing of the code so that u can better understand it.
I did answer what you want. My earlier post can throw the SQLException you have described. My earlier post is different than any other posts in this thread, so if you think it is the same answer "again" then read it a little closer. Some other programmers have said that this SQLException can also be thrown if: 1. You have threading issues. Can't help you hear, this more design than coding. 2. Not enough memory in the jvm. To increase it I think the run statement is 'java -ms32m myApplication' 3. You have too many resultsets/statements open. Make sure that you close each and every statement and resultset. Supposedly it also helps to null out the objects after you are done with them(resultset = null . Also, make sure you don't exceed the maximum numbers defined by your driver. 4. Some say that the just upgraded jdk's (1.3) and it went away
After looking at the code sample I'd agree with Jamie, its likely a problem with the organisation of the code. Try removing the centralised connection and getting each operation to completely manage its own database resources (get connectin, make statement, get ResultSet, release all). It will be less efficient, but you are likely to get a program that works which you can then play with. Dave