depends, if the reason, why the db storing failed is because a duplicate value for example, 409 Conflict is perfectly fine.
422 Unprocessable Entity could be used too, if it makes sense.
but the generic 500 Internal Server Errorserver side error (that's the point, because 4xx should be used for client side errors) is OK too. you can add a meaningful error message to the response body as well.