Which sentence is grammatically correct?

Chemically, water is a compound of hydrogen and oxygen with the formula H2O.
or
Water is a compound of hydrogen and oxygen, having the formula H2O.

Thanks.
4 answers 4