In web-development, what languages does a frontend developer typically use?

JavaScript, CoffeeScript, TypeScript are used to implement the front-end logic.
HTML and CSS are used for web page visual look implementation.

Which type of developer is responsible for making sure the logic of the application runs smoothly?

I believe all the developers are.
But most of the logic is supposed to be executed at the back end side, so maybe the “back end developer” is a correct answer.

Which type of developer is responsible for handling databases?

A back end developer is (or a DBA if the company has a dedicated role for that).
If the term “handling” imposes administration and security setup, it might be a job for system administrators or devops engineers.

Which languages can you use in order to communicate with a database (give 2 examples)?

SQL is used for database queries.

You can use any programming language with the RDBMS driver matching a given database. Some typical choices are : C#, PHP, Ruby, Python, Java

Some ORM library wrapper can be used optionally. For example, C# has a LINQ langauge.
GraphQL is also an option if its integration is implemented on a back end side.