If you want to get SQL database name in axapta which is connected with your current Ax application then you can write below code to check the same.
Sqlsystem sys = new Sqlsystem();
info(sys.logindatabase());