On my local machine, I have multiple wordpress versions installed so I can test the themes and plugins I develop.
wp-content folder you need to add WP_CONTENT_DIR with path to this folder to each
wp-config.php file of each your sites. All of these WP_CONTENT_DIR constants should have the same path to one folder. Read more about it here: http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content
To share the same database, you just need to setup the same database settings in each
wp-config.php files. Read about it here: http://codex.wordpress.org/Editing_wp-config.php#Set_Database_Name
UPDATE: To make your urls work correctly define
WP_HOME constants which will override options settings. Read about it here: http://codex.wordpress.org/Editing_wp-config.php#WordPress_address_.28URL.29
Have you considered a WordPress Multisite Network setup? Have you considered WordPress (Multisite) Network setup? Take a look at this: http://codex.wordpress.org/Create_A_Network
A multisite network is a collection of sites that all share the same
WordPress installation. They can also share plugins and themes.
The individual sites in the network are virtual sites in the sense that
they do not have their own directories on your server, although they
do have separate directories for media uploads within the shared
installation, and they do have separate tables in the database.