How to get the post_name when in preview?

is_preview() is supported. You may also want to look into is_singular() which covers posts, pages, and attachments.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)