You may convey a work based on the Program, or the modifications to produce it from the Program [only if you] license the entire work, as a whole, under this License
but then, 0 Definitions:
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
Does it mean that I have to modify the source to actually make my code fall under (A)GPL? Or just relying on (A)GPL software (let's say a database) makes my software automatically 'adapt' the (A)GPL software?
In the license there is nothing about 'derivative work'.
The question is – does “relying” on the (A)GPL software require a copyright license from the (A)GPL authors? This depends on your applicable copyright laws, not on the (A)GPL.
If you do not publish (or publicly perform) your software, copyright is irrelevant and you do not need the (A)GPL license.
If your software and the (A)GPL software are entirely separate programs and only communicate “at arms length”, then they are surely separate programs and the copyright of the (A)GPL software cannot affect your software.
If your software is combined with (A)GPL software into one program, there is some debate whether this means that the (A)GPL also applies to your code. It is safest to assume that it does apply, so you can only publish or publicly perform this program if you follow the (A)GPL license.
So it's not necessary to modify the (A)GPL licensed software. Including it or combining it with your software may be sufficient to trigger the (A)GPL requirements.
In the specific case of databases, this can be fairly tricky as the database server and the database driver inside an application may or may not be sharing intimate data structures. I would generally assume that such sharing is not the case, so that the copyright license of an unmodified database server software does not affect your software. E.g. running an (A)GPL database on an internal network does not subject a public web server that connects to this database to the (A)GPL.