This method of the Connection class indicates whether the state of the object is open or closed or, for objects executing an asynchronous method, whether the current state of the object is connecting, executing, or fetching.
public int getState();
Returns an ObjectState value. The default is CLOSED.