HI Martin, thanks for the detailed comments.
I'd probably create several overloaded "close" methods
The reason I wrote this method was exactly yo avoid this.
That way I wouldn't have to cast and would get a compiler warning if I tried to pass a wrong object to the method
Since I'm accepting Object in my method, why would compiler flash a warning? Even if one passed another object type, it would get filtered out in the if conditions.
The catch block should only catch SQLException errors
Agree. Actually this is just a sample I wrote in hurry
Moreover, you should understand that the dbResource variable contains a copy of the reference
Objetcs are passed by reference. No such thing as copy of reference?