The shipping charge rule will be applied if the value of the quote returned is greater than 0. The value that is returned by UPS should be stored in the following session variable:
$_SESSION["<your cart name>_UPS_Quote"]
If your dynamic package dimensions are not working there is likely a problem with how that information is bound in the shipping quote server behavior. Have you tested this out to confirm if your recordset values are being used in the code? You can also try some static testing by hard coding these values from the db to see if you get a valid result that way.