• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invalid column 1, use next() before calling getXXX()

 
Ricardo Marques
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I have a connection pool and there is a first level tier of clients which accesses the database. This tier returns a ResultSet to be used by objects in a second level tier.
Each element of the second tier, has one static element of the first tier, which is called when an access to the DB is needed. This way I am always reusing the connections to the database.
One of the second level clients, performs several selects, all of them using the first level client which gets its ReusltSet cleaned after every execution, when I call the corresponding method.
However there seems to be some kind of problem. Somewhere in my code I'm doing this:

I get a runtime exception which says I cannot do getLong(1), without doing next() first, but I am doing that. I don't understand this problem. I'm using BEA Weblogic 6.1 with MSSQL Server 2000.
Can anybody help? Thanks.
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if no results were returned? You should be checking if there are results before retrieving the value...

not sure if this is the problem though. It's hard to tell, when you separate the connection/statement/resultset from each other. The code to the connection may affect your resultset as well as your code to the statements.
Jamie
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If their were no results he would get a different exception. He has likely just overlooked something. can you be sure of exactly where the exception is being thrown? are you looking at a stack trace?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic