I got this error, add full control for all user on $SDEHOME and I got the same error.
Then I check if the user that run the service that start the program using arcobjects code, then I see that the user who has the permission to run this service was deleted.
Then I change for an user that exist and had permission and works fine.
Soooo... as usually the message error could betray you.
When trying to connect to a database in ArcCatalog or ArcMap, a user gets this error: "Failed to connect to database. Temporary file I/O error -- possibly $SDEHOME/temp is full"
This is due to the temp folder being full
Solution:
Set the Windows Environmental Variables to "c:\temp" then logged out and logged back in and the connection was successful (see screenshot)