SPWeb.AppDatabaseName property
SharePoint 2013
Gets the name of the app database associated with this Web. This property can be null.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Gets the name of the app database associated with this Web. This property can be null.