Videos / Other Resources

No attachments were found.

How do I setup Holdem Manager to share one database between two computers?

Overview:

How do I setup Holdem Manager to share one database between two computers? (IE USB Hard Drive or Thumb Drive)

Note:  Only Advanced PC users should attempt this




Answer:


Note:  Your database speed will be drastically reduced when you use a USB Hard Drive or USB Thumb Drive to store your database because it's limited to USB port speed.  (You've been warned)

 

You'll need an external hard drive that can connect to both PCs via USB port.

For the purpose of this tutorial I will be referring to the main installation on the desktop PC and the 2nd installation on the Laptop just so we dont get mixed up. I strongly recommend that your experienced in tasks like creating and naming new folders, copying files and tweaking windows settings and understand the difference between the C drive and the D drive etc. This also involves editing the registry so please dont try this if your not comfortable. Please backup all your files prior to attempting this in case something goes wrong. Also i havent tried testing this between 2 different PostgreSQL versions so if it is possible please use the same version on both PC's.

If you are installing postgreSQL for the first time please complete only section A and Section C
If you have PostgreSQL already installed then skip A and only do B & C although youll need to follow some steps in A when you get to section C because youll be doing a new install on the 2nd PC.

The 1st PC or Desktop PC should be the one with the main database, if you have 2 databases running then export the hands into the 1 database prior to following these instructions.

A) New Install Of PostgreSQL on the desktop PC

If you havent installed PostgreSQL yet please follow these instructions otherwise skip to section B:

Start the PostgreSQL Installation until you get to this stage:

 


Youll notice that its highlighting PostgreSQL in that screenshot and at the bottom its going to install this into the C drive. This is correct as your C drive is the default drive where windows is stored and this is where the postgreSQL files need to be.


Now if we move it to the "Data Directory" we can see that is also set to install the Data Directory on the C drive which we dont want.


So we should click so that "Data Directory" is highlighted and then choose browse and we see a window like the screenshot below:

As you can also see ive chosen to have the data directory in the D drive. This is the external hard drive but in your case it might be a different drive like E or I etc so choose the correct drive as it needs to be on the external hard drive. It may prompt to create a new folder as the folder dosent exist and if so please choose Yes.


Follow the instructions from here for installing the next steps: http://www.holdemmanager.net/PostgreSQL_Install_Help.html

NB: Take note of the username and password you use as youll need to use the same ones when installiing on the laptop.

This completes all you need to do on the desktop computer so skip to section C) Installing Postgres On The Laptop PC now

B) PostgreSQL if you already have it installed

First you need to have PostgreSQL installed on the C drive where windows is installed but you need to install the Data folder i.e Database on the external hard drive. We need to close down the PostgreSQL service while doing this. Go to start > Control Panel > Administrative Tools (Use classic View) > Services 

This will bring up the following window:


Right click this and choose Stop to stop the service.

Then create the following folders in the external hard drive. Program Files and inside that folder create a PostgreSQL folder and inside that create a data folder. So if your external hard drive is on the D drive you would have created a path D:\Program Files\PostgreSQL\data

Then go to where you have the data folder which will be c:\program files\PostgreSQL\8.2\data by default unless you changed it. Copy all the files in here to the new data folder we just created above on the external hard drive. If this is a big database this may take some time.

When youve done that we need to tell PostgreSQL where the new data folder is located and to this we need to edit the registry.

Windows XP
Go to Start > Run and type the following in the textbox: regedit and then press enter and a new window should appear like in the screenshot below:

Windows Vista
Go to Start > All Programs > Accessories > Run then type the following in the textbox: regedit and then press enter and a new window should appear like in the screenshot below:


Navigate the folders to this path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pgsql-8.2 and you should then see the following screen:


In the image above ive highlighted the key we need to change. Go to image path and right click and choose modify and you should see the following:

"C:\Program Files\PostgreSQL\8.2\bin\pg_ctl.exe" runservice -w -N "pgsql-8.2" -D "C:\Program Files\PostgreSQL\8.2\data\

Now we need to only change the bit thats in bold. This is the location that PostgreSQL looks for the database files but weve moved them to the external hard drive so we must tell it the location. Make sure you get the path exactly correct. The easiest way is to navigate to the actual Data folder on the external hard drive and right click any file inside that folder and choose properties and youll see this:


As you can see for location it shows the actual path, in my case its the I drive but yours maybe different so just copy and paste it. So if i was creating the key based on that screenshot my old key would be:

"C:\Program Files\PostgreSQL\8.2\bin\pg_ctl.exe" runservice -w -N "pgsql-8.2" -D "C:\Program Files\PostgreSQL\8.2\data\

And i should change it to this:
"C:\Program Files\PostgreSQL\8.2\bin\pg_ctl.exe" runservice -w -N "pgsql-8.2" -D "I:\Program Files\PostgreSQL\8.3\data\

That now has everything in place so we should close everything down and make sure to reboot the PC.

C) Installing Postgres On The Laptop PC

Attach the external Hard drive to the Laptop. 

The first thing we need to check is that the drive is the same on the laptop as it was on the desktop otherwise it wont work. When you attach a drive windows assigns the drive a letter however your laptop may not assign the same letter as your desktop. So if you had it on the D drive when you made the installation on the desktop you need to make sure its also on the D drive on the laptop and if not follow these instructions to force windows to name it the D or applicable drive. The instructions are the same for both XP and Vista http://www.5starsupport.com/xp-faq/1-49.htm

Follow the exact same instructions as you did in section A. Also when it asks you for you username and password during installation please use the same ones that you did when you installed HM on the desktop. The only difference is when you see the following screen please untick "Initialise Database Cluster" as you already have the database info in that folder.


This will grey out all the options like in the screenshot below. Just choose next and continue with the installation as per the above instructions in section A. Now you should be able to connect to the database when you load HM, it may prompt you for the username and password so remember to enter the same username and password


On last thing to note, when you remove the external hard drive from the PC the next time you connect the PostgreSQL service will have stopped since it dosent have access to the database so restart the service by following these instructions before attempting to connect to the database.

Go to start > Control Panel > Administrative Tools (Use classic View) > Services 

This will bring up the following window:


Right click this and choose Start to restart the service.

 

 

 

| More

Related Articles


User Opinions (7 votes)

28% thumbs up 71% thumbs down

How would you rate this answer?



Thank you for rating this answer.

Visitor Comments

No visitor comments posted. Post a comment

Post a comment

To post a comment for this article, simply complete the form below. Fields marked with an asterisk are required.
   Name:
   Email:
* Comment:
* Enter the code below:
 

Continue