Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Nullpointer with RowSet  RSS feed

 
Lucas Moraes
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody, I'm currently studying for the OCPJP 7 and I'm programming some JDBC classes, It was all ok until I found this strange bug and want to know why is this happening.

The situation is as follows:

I have this class TestRowSet.java:



but I'm getting a nullpointer when the code reaches row.first() method, and if I remove this line the nullpointer is at row.next() instead, as if there is no resultset object anymore after the commit method.

if I remove the row.commit method, the code prints fine(only doesn't save anything on the database) , and strangest yet is that I have a similar class using the plain old ResultSet instead:



But this class runs fine, so I'm wondering, what is wrong in the rowset class? is there any difference between Connection.commit() and JdbcRowSet.commit()?

 
Lucas Moraes
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the question really that difficult? or I didn't explained clear enough?
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37381
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your explanation is fine. It seems like a bug in the driver, not something we can explain.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!