Yes, it's complicated. It's complicated because you need to
learn both browser programming (Javascript) and server programming (many
choices of language).
As John notes below, you cannot "get
a Database connection to get data from the server".
It's not something that the browser can do.
You need to write code for your server to
do that. Then you can, for example, use jQuery $.ajax() to make
requests to your server. Or perhaps your server will just include
something from the database in a page. (You haven't given us any
details of what you want to do.) Your server code will then get the
data from the database.
- pick a server language and/or
framework. There are many. PHP is popular, but not necessarily "good"
- pick a database. MySQL is popular.
- Read the documentation, get a book,
take a class, etc.