Nowadays I am using the version 42.2.25 of postgresql jdbc driver and I would like to know if is compatible with the postgresql version 15.3
There is no official statement which JDBC driver version works with which PostgreSQL server version. The rule of thumb is that you should always use a driver version that was released after the server version. New drivers know how to speak to an old server, but not vice versa.
Since you want to support the latest released version, you should use the latest driver (42.6.0 at the time of writing). 4.2.25 is comparatively old. You can try it, but you risk running into bugs, and if you do, the first thing we'll tell you is that you should upgrade. So you may as well upgrade right away.