In the character table of the Trinity database for version Mist of Pandaria, there are 4 fields:
speccount: This field contains how many specializations have the character.
activespec: This field contains which specialization is active, it has value 0 or 1
specialization1: This field contains the ID of the especialización1 in the ChrSpecialization.dbc file for the core of Mist of Pandaria.
specialization2: This field contains the ID of the especialización2 in the ChrSpecialization.dbc file for the core of Mist of Pandaria.
The solution was to incorporate a table in the database of the web site that I'm developing with the values of ChrSpecialization.dbc file, so to locate the active specialization, I take the ID for the active specialization, that I can be obtained from the character table, then I found on my database the name of specialization with the ID.