Magnetically and optically confined Bose-Einstein condensates were studied near a microfabricated surface. Condensate fragmentation observed in microfabricated magnetic traps was not observed in optical dipole traps at the same location. The measured condensate lifetime was >or=20 s and independent of the atom-surface separation under both magnetic and optical confinement. Radio-frequency spin-flip transitions driven by technical noise were directly observed for optically confined condensates and could limit the condensate lifetime in microfabricated magnetic traps.