Socket programming. Sockets are used differently in different operating systems, so you will want to google "c++ socket <insert Operating System here>"
First of all, what kind of DB? If it's something popular like MySQL then there are libraries that specialize in connecting to them so I wouldn't just use a regular sockets.
If your DB somehow doesn't have an API, then consider using a library like SFML, (libcurl?) or Boost ASIO. It will take a bit more work to get started, but in the end things will be easier to add onto or update.
If you do decide to go with regular socket programming, then most major OS's out there base their API on BSD sockets. There are pretty major differences and considerations here and there but if you learn one then the ground work for the others is pretty much the same.