Have you ever wondered why oil and water don't mix while sugar and water do? The answer to that question, and many others, comes from an analysis of the factors affecting solubility--the propensity of a solute to form a solution with a given solvent. A thermodynamic cycle constructed for the formation of a solution shows that a solution will form when the strength of the interaction (from dipole-dipole, van der Waals, hydrogen bonding, etc.) between solvent and solute is greater than the energies of the separated solute and solvent. The strength of that solute-solvent interaction is largely determined by the structures of the solvent and the solute. Like dissolves like--only solutes with similar properties or structural features in common with the solvent will be dissolved.
The solubility of solids in aqueous solution, generally increases with the temperature of the solution. There are a few exceptions to this rule, such as Na2SO4 and all gasses. That temperature effect is governed by the entropy of solution. Solids become less ordered when dissolved in water giving a positive ΔSsoln. Because ΔG = ΔH - TΔS, a positive entropy term will lead to an increase in solubility with increasing temperature. Gasses become more ordered when dissolved in water (due to the large negative change in volume for the gas) so they have negative entropies of solvation Therefore, gasses have a decreasing solubility with increasing temperature.
However, it is possible to increase the solubility of a gas in a given solvent by increasing the pressure of the gas above the solvent. That effect reduces the size of the negative entropy of solvation for gasses by increasing the order of the gas in the gas phase. The equation that describes this effect is called Henry's law.