The adsorption of octane on Cu(110) was studied by x-ray absorption and x-ray emission spectroscopy, in combination with spectrum calculations in the framework of density functional theory, as a model system for alkane adsorption on transition metals. Significant electron sharing between the adsorbate and metal surface and involvement of both bonding and antibonding C-H molecular orbitals in the molecule-metal bond was found. The calculations were extended to the case of octane adsorbed on Ni(110), and the position of the metal d band was found to be important for the bonding. The results were generalized to show that this is important for the efficiency as an alkane dehydrogenation catalyst.