Check your GDAL version. Raster support was only added to the GDAL OpenFileGDB driver in version 3.7.
To check, either:
Or in a terminal, run the command
gdalinfo --version
$ gdalinfo --version GDAL 3.4.1, released 2021/12/27 <== No raster support $ gdalinfo --version GDAL 3.8.5, released 2024/04/02 <== Yes raster support
So for the above QGIS/gdalinfo
examples, only the 2nd ones would be able to read raster data.
Note:
I use the classical method (Add vector layer, directory, gdb database
That's the classic way to add vector data. If you want to add raster data, use the Add raster layer method.