DEV Community

mmllllzcn
mmllllzcn

Posted on

GBase Database: Configure sqlhosts in Four Steps to Enable Remote Connections

Local connections work, but remote connections fail. This is one of the most common issues after a fresh GBase Database(GBase 8s) installation.

The error often looks straightforward:

Attempt to connect to database server(ol_gbasedbt12120) failed
Enter fullscreen mode Exit fullscreen mode

But the message does not tell you whether the problem is the listening address, hostname resolution, instance configuration, or firewall.

This guide explains how to troubleshoot GBase Database remote connectivity in four steps, with a verification command at each stage.

Start with the Symptom: Can Local Connections Work?

Before changing configuration files, test the instance locally:

dbaccess - -
Enter fullscreen mode Exit fullscreen mode

The result determines where to investigate next:

  • Local connection succeeds: The instance is responding. Focus on the listening address, hostname resolution, and remote connectivity.
  • Local connection fails: Check the instance status and local client environment before modifying network settings.

A common cause in GBase Database(GBase 8s) is that the default instance listens on localhost. Local clients can connect, but remote clients cannot reach the service through the server's external IP address.

Step 1: Update the Listening Address in sqlhosts

Open the connection configuration file:

vim $GBASEDBTDIR/etc/sqlhosts
Enter fullscreen mode Exit fullscreen mode

Find the relevant instance entry:

ol_gbasedbt12120 onsoctcp localhost 9088
Enter fullscreen mode Exit fullscreen mode

Replace localhost with the server's actual IP address:

ol_gbasedbt12120 onsoctcp 192.168.x.x 9088
Enter fullscreen mode Exit fullscreen mode

The four fields represent:

  1. Server name
  2. Connection protocol
  3. Hostname or IP address
  4. Service name or port

This change updates the configured listening address. It does not independently control which remote clients are authorized to connect.

That distinction matters when troubleshooting GBase Database network connectivity: binding configuration and access control are separate concerns.

Step 2: Configure Hostname Resolution

Next, make sure the server IP address maps to the correct hostname.

Add an entry to /etc/hosts:

echo "192.168.x.x hostname" >> /etc/hosts
hostname
Enter fullscreen mode Exit fullscreen mode

Compare the hostname returned by hostname with the name in the hosts file.

Do not rely on memory. A hostname mismatch can produce connection failures that look similar to a network outage.

For environments with multiple database nodes, verify that the relevant hostname mappings are consistent across the machines that need to communicate.

Step 3: Restart the GBase Database Instance

Changes to the connection configuration need to be applied by the instance.

For an existing instance, use:

onmode -ky
oninit -vy
Enter fullscreen mode Exit fullscreen mode

For first-time initialization, the command may instead be:

oninit -ivy
Enter fullscreen mode Exit fullscreen mode

The distinction is important:

  • oninit -vy starts an existing initialized instance.
  • oninit -ivy includes initialization and should not be used casually on an existing production instance.

Plan the restart carefully because shutting down and starting the database interrupts active connections.

Step 4: Verify the Listening Address

Do not assume that saving sqlhosts means the configuration is active.

Check the actual listening socket:

ss -tlnp | grep 9088
Enter fullscreen mode Exit fullscreen mode

The expected result should show the configured service listening on the intended server address or on an appropriate wildcard address.

If it still shows:

127.0.0.1:9088
Enter fullscreen mode Exit fullscreen mode

investigate whether:

  • You edited the configuration file actually used by the instance.
  • SERVERNUM and NETTYPE are consistent with the intended configuration.
  • The instance restarted successfully.

This is the key verification step. A modified configuration file is not proof that the database is listening on the new address.

If the Address Is Correct but Remote Access Still Fails

Check the firewall.

For systems using firewalld, the following commands open TCP port 9088:

firewall-cmd --add-port=9088/tcp --permanent
firewall-cmd --reload
Enter fullscreen mode Exit fullscreen mode

Verify the result:

firewall-cmd --list-ports
Enter fullscreen mode Exit fullscreen mode

Only open the required port and ensure that the firewall policy follows your organization's network security requirements.

One More Check: Verify DBSERVERNAME

There is another configuration detail that is easy to overlook.

Check the instance name in onconfig:

grep DBSERVERNAME $GBASEDBTDIR/etc/onconfig.*
Enter fullscreen mode Exit fullscreen mode

Compare the value of DBSERVERNAME with the first column of the corresponding sqlhosts entry.

For example:

DBSERVERNAME ol_gbasedbt12120
Enter fullscreen mode Exit fullscreen mode

And:

ol_gbasedbt12120 onsoctcp 192.168.x.x 9088
Enter fullscreen mode Exit fullscreen mode

The names must match exactly.

GBase Database does not automatically resolve differences between these identifiers. Even one character out of place can cause a connection failure that looks like a network problem.

Collect Four Pieces of Evidence for Troubleshooting

Once the configuration is updated, collect the following outputs:

grep ol_gbasedbt12120 $GBASEDBTDIR/etc/sqlhosts
hostname
ss -tlnp | grep 9088
firewall-cmd --list-ports
Enter fullscreen mode Exit fullscreen mode

These commands provide four useful pieces of evidence:

Evidence What it verifies
sqlhosts entry Configured connection address and port
hostname Current server hostname
ss -tlnp Actual listening address and port
firewall-cmd --list-ports Configured open firewall ports

Include these results in the troubleshooting ticket or handover record.

Instead of reporting only that remote access has been restored, the operator can show exactly which configuration and network checks have passed.

Why the Troubleshooting Order Matters

The sequence is deliberate:

  1. Test local connectivity.
  2. Update the listening address.
  3. Verify hostname resolution.
  4. Restart the instance.
  5. Confirm the actual listening socket.
  6. Check firewall rules if remote access still fails.
  7. Verify DBSERVERNAME against sqlhosts.

Checking the firewall before confirming that the instance is listening on the correct address can lead to unnecessary changes.

Similarly, repeatedly editing sqlhosts without checking DBSERVERNAME can waste hours on a simple naming mismatch.

Final Thoughts

Remote connectivity troubleshooting in GBase Database(GBase 8s) is not just about changing localhost to an IP address.

It requires verifying the complete path: instance configuration, hostname resolution, service startup, listening sockets, and firewall rules.

The most useful habit is to verify every change with actual command output rather than assuming that a saved configuration has taken effect.

A reproducible troubleshooting process makes the next GBase Database deployment easier to operate and much easier to hand over.

Top comments (0)