Welcome › User Forums › Software Problems › Database Connection Problems (Advice)
Tagged: connecting database network
- This topic has 3 replies, 1 voice, and was last updated 6 years, 11 months ago by Chris.
-
AuthorPosts
-
February 7, 2017 at 11:42 pm #100ChrisKeymaster
Due to the myriad of possible PC configurations, establishing the initial connection between TScore and its database can be a little challenging!
We have made huge improvements in automating this process at V10, but just in case you still hit problems, here is an overview of how it works, what can go wrong and how to fix it. I’m sure others will add their experiences and handy hints too!Note – this document has this info and more
TScore uses the highly regarded open source PostgreSQL database running either on the same computer, or on a network connected computer.
First we will look at connecting to a database on the local PC.Basic stuff:
1. You must install the PostgreSQL server. Set the username and password to ‘postgres’ for ease of setup. Leave the connection port set to 5432. If you are using an older version (v8) of PostgreSQL, then install it in a ‘real’ folder (e.g. C;\\postgres) rather than in the default Program Files location, as there were all sorts of permission problems with early releases. Newer version can be put in the default path, but I personally prefer to put it somewhere other than on my system drive.2. You must install the PostgreSQL OLEDB client connector, even if you are on the same computer. You can default all the settings here. IMPORTANT – THIS IS NO LONGER NEEDED
3. After installation, check that the database server is running. (You can look for the PostgreSQL service in task manager or the Windows Services console).
4. When you run TScore, it will try to connect to the local computer by name. If you are running in a DHCP/DNS controlled network, it should resolve the name to its IP address ok and connect immediately. If the TScore Connect dialog says that it cannot find the server, try typing in ‘127.0.0.1’ instead of the server name. If that succeeds, then the problem is simply a computer name lookup problem. I usually work around this by configuring the network adapter IPv4 properties to allow NETBIOS over TCP/IP. ( I shall put details of how to do this in a separate post)
5. TScore V10 will attempt to configure the local PostgreSQL access permissions to allow any computer on the local network to connect to the service. It does this by editing the pg_hba.conf file that resides in the PostgreSQL\Data folder, adding in ‘trust’ entries for all likely local addresses (Iv4 and IPv6). If you want to tighten up security, you must edit this file to lock down access afterwards. You should only need to do this if you are sharing your LAN with other untrusted computers.
6. When it first runs and connects to a new database server, TScore will offer to install a number of demonstration competitions for you. It’s best to say yes here, ‘cos it makes it a whole lot easier to learn how TScore operates if you start with a working competition.
7. The above fixes should be enough to get your local computer working, so you can verify all the components are in place.
8. Now try a remote computer connection. For these, you really only need to install the PostgreSQL client connector and TScore itself. However, it’s always a good idea to have a local database available in case your network hardware blows up. Also, the PostgreSQL server installer includes some useful Microsoft C++ run-time libraries that may not be installed on your computer and could prevent TScore from installing or running. Once installed, it’s a good idea to turn off the service and set it not to start automatically to avoid the risk of accidentally connecting to the wrong server. (You can do this in the Services console, or from the Task Manager Startup tab in Windows 10)
9. Now check that your computer is connected to the network correctly and can communicate with the server PC. This is easily done using a command shell (type ‘cmd’ in Windows search). Just ‘ping’ to server by name (type ‘ping myservername’ and see if it responds). If the name cannot be resolved, try to ping the computer directly by its IP address. you can discover this by running cmd on the server and typing ‘ipconfig’. Part way down the list you should see an entry for your computer’s network connector that gives its IP address – something like 192.168.1.4 for example. You can then go to the client computer cmd window and type ‘ping 192.168.1.4’ and it should reply this time.
10. Once you have determined that the two computers are actually connected (and, ideally can recognise each other by name), you can run TScore on the client PC and try to connect to the server. It should just work, in which case congratulations! If it cannot find the server by name, try typing its IP address in place of its name – that usually avoids the name resolution problem.
More details to follow in this thread!
February 25, 2017 at 5:17 pm #185ChrisKeymasterIt is possible to hit problems arising from different computers using different network protocols. If your main computer connects ok, TScore never has to take corrective action to enable the the pg_hba.conf file so it can accept connections from your local network. If you then connect a second computer that uses a different protocol, it may still fail to connect, and will be unable to change the pg_hba.conf file.
To fix this, you need to manually locate your pg_hba.conf file. You should find in in your PostgreSQL ‘data’ folder.
Edit this file in notepad and file the section that defines network permissions.
Insert the following lines to enable all computers on your network:host all all fe80::0/64 trust
host all all ::1/128 trust
host all all 127.0.0.1/32 trust
host all all 192.168.0.0/16 trust
host all all 172.16.0.0/12 trust
host all all 10.0.0.0/8 trustIf you want to lock down access to specific computers (for example, if you are allowing guests onto your network), then see the PostgreSQL forums and documentation for help. We can also point you in the right direction!
April 15, 2017 at 12:43 pm #302ChrisKeymasterOne further thing that can cause problems on some computers is if you do not have edit permissions to the PostgreSQL data folder. This can happen if you install as a non-administrator in the default PostgreSQL location (Program Files).
In this case, when you look at the pg_hba.conf file, it will have no extra lines added by TScore, and if you try to change it, it will demand administrator permissions.To fix this, just change the permissions on the file, or login to the computer and run TScore as an administrator to perform the initial setup.
January 10, 2018 at 11:04 pm #493ChrisKeymasterI have created a document that contains some useful network troubleshooting tips.
You can download it here.
- This reply was modified 1 year, 1 month ago by Chris.
-
AuthorPosts
- You must be logged in to reply to this topic.