When an SQL select statement doesn't return any rows, is an SQLException thrown?

Bozidar Dangubic

No. If you want to throw an exception, you could wrap your SQL related code in a custom class and throw something like ObjectNotFoundException when the returned ResultSet is empty.

Joe Sam Shirah adds:

A ResultSet can validly contain zero, one or many rows. For a related question and additional information see Why does my "if(rs==null)" condition always evaluate to false after executing a query?.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact