You won't be able to use the same database. If you do your going to have all sorts of problems. With the biggest problem being you cannot have two different values for the site URL.
I would suggest a managed hosting solution such as Pantheon. This will provide you with a development, test, and live environment.
All code updates are made in your development environment. From there you deploy those changes to the test environment.
When deploying to the test environment, there is an option to pull in the database and media files from the live environment.
After thoroughly testing everything in the test environment. You'll deploy your changes to the live environment.
If everything was working in the test env. You can be certain that you didn't introduce any bugs in the live environment after you deployed.
The nice thing about Pantheon is you can spin up a new sandbox site for free. Once your ready to launch. You'll obviously have to switch to a paid plan.
If Pantheon is out of the question. I recommend recreating a similar workflow with your current hosting provider.
Let me know if you have any questions.