Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JayBird / Firebird nullpointerexception when using getInt()

 
Greg Reeder
Ranch Hand
Posts: 99
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Does anyone have any experiance with Jaybird? I am trying to use the resultSet.getInt("columnName") method to set an int object. Code :



the column name is correct, I checked it, rechecked it and rechecked it yet again. If I take out the int tax line, I have the same issues the next time I use the getInt() for amount and income. Any hints as to what Im doing wrong?

Greg
 
Rob Spoor
Sheriff
Pie
Posts: 20526
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should definitely not get a NullPointerException when calling getInt. If the database value is null getInt should return 0 (required by the ResultSet API), and if the column doesn't exist it should throw an SQLException, not a NullPointerException. Which driver are you using? Is it the latest version?
 
Greg Reeder
Ranch Hand
Posts: 99
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is the latest download, 2.1.6. I am at a bit of a loss as to what I should do. .getFetchSize returns 0 although FlameRobin shows that the size should come out as 2. I use the same code, and it works in the FlameRobin front end (where I test all of my statements before wiring them into my DBController class. I've even gone so far as to copy and past it, Ive shut down the server and restarted it to garantee that there was no back ground error. I dont know what Im screwing up.
 
Greg Reeder
Ranch Hand
Posts: 99
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved. Stupid errors only. It was fixed when joined two tables together and accessed the database once rather than trying to access it a second time while already reading from it. The nullpointer exception was caused by my own stupidity. It is now fixed.
 
Greg Reeder
Ranch Hand
Posts: 99
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic