Updated on 2024-05-07 GMT+08:00

Configuring a Data Source in the Windows OS

Configure an ODBC data source using the ODBC data source manager preinstalled in the Windows OS.

Procedure

  1. Replace the GaussDB client driver.

    Decompress GaussDB-Kernel_Database version number_Windows_Odbc.tar.gz and click psqlodbc.exe (32-bit) to install the driver. Decompress the GaussDB-Kernel_Database version number_Windows_Odbc_X64.tar.gz (64-bit) driver package or GaussDB-Kernel_Database version number_Windows_Odbc_X64.tar.gz (32-bit) driver package, and click gsqlodbc.exe to install the driver.

  2. Open the driver manager.

    When configuring the data source, use the ODBC driver manager corresponding to the ODBC version. If the 64-bit ODBC driver is used, the 64-bit ODBC driver manager must be used. Assume that the OS is installed on drive C (if the OS is installed on another drive, change the path accordingly):

    • If you want to use 32-bit ODBC driver manager in a 64-bit OS, open C:\Windows\SysWOW64\odbcad32.exe. Do not choose Control Panel > Administrative Tools > Data Sources (ODBC).

      WoW64 is short for Windows 32-bit on Windows 64-bit. C:\Windows\SysWOW64\ stores the 32-bit environment on a 64-bit system. C:\Windows\System32\ stores the environment consistent with the current OS. For technical details, see Windows technical documents.

    • For a 32-bit OS, open C:\Windows\System32\odbcad32.exe or choose Computer > Control Panel > Administrative Tools > Data Sources (ODBC) to open Driver Manager.
    • For a 64-bit OS, choose Control Panel > Administrative Tools > Data Sources (ODBC) to enable driver management.

  3. Configure a data source.

    On the User DSN tab, click Add and choose PostgreSQL Unicode for setup.

    For details about the parameters, see Configuring a Data Source in the Linux OS.

    You can click Datasource to configure whether to print logs.

    The entered username and password will be recorded in the Windows registry and you do not need to enter them again when connecting to the database next time. For security purposes, you are advised to delete sensitive information before clicking Save and enter the required username and password again when using ODBC APIs to connect to the database.

  4. Enable the SSL mode.

    Change the value of SSL Mode in Step 2 to require.

    Table 1 sslmode options

    sslmode

    Whether SSL Encryption Is Enabled

    Description

    disable

    No

    SSL connection is not enabled.

    allow

    Possible

    If the database server requires SSL connection, SSL connection can be enabled. However, authenticity of the database server will not be verified.

    prefer

    Possible

    If the database supports SSL connection, SSL connection is preferred. However, authenticity of the database server will not be verified.

    require

    Yes

    SSL connection is required and data is encrypted. However, authenticity of the database server will not be verified.

    verify-ca

    Yes

    SSL connection is required and whether the database has a trusted certificate will be verified. Currently, Windows ODBC does not support the certificate-based authentication.

    verify-full

    Yes

    SSL connection is required. In addition to the check scope specified by verify-ca, the system checks whether the name of the host where the database resides is the same as that in the certificate. Currently, Windows ODBC does not support the certificate-based authentication.

  5. Configure a GaussDB server. For details, contact the administrator.
  6. Restart the database instance.

    gs_om -t stop
    gs_om -t start

Verifying the Data Source Configuration

Click Test.

  • If the following information is displayed, the configuration is correct and the connection succeeds.

  • If error information is displayed, the configuration is incorrect. Check the configuration.

FAQs

  • connect to server failed: no such file or directory

    Possible causes:

    • An incorrect or unreachable database IP address or port was configured.

      Check the Servername and Port configuration items in data sources.

    • Server monitoring is improper.

      If Servername and Port are correctly configured, ensure the proper network adapter and port are monitored by following the database server configurations in the procedure in this section.

    • Firewall and network gatekeeper settings are improper.

      Check firewall settings, and ensure that the database communication port is trusted.

      Check to ensure network gatekeeper settings are proper (if any).

  • The password-stored method is not supported.

    Possible causes:

    sslmode is not configured for the data source. Set this configuration item to allow or a higher level to enable SSL connections. For details on sslmode, see Table 1.

  • authentication method 10 not supported.

    If this error occurs on an open-source client, the cause may be:

    The database stores only the SHA-256 hash of the password, but the open-source client supports only MD5 hashes.

    • The database stores the hashes of user passwords instead of actual passwords.
    • If a password is updated or a user is created, both types of hashes will be stored, compatible with open-source authentication protocols.
    • An MD5 hash can only be generated using the original password, but the password cannot be obtained by reversing its SHA-256 hash. Passwords in the source version will only have SHA-256 hashes and not support MD5 authentication.
    • The MD5 encryption algorithm has lower security and poses security risks. Therefore, you are advised to use a more secure encryption algorithm.

    To solve this problem, you can update the user password (see ALTER USER) or create a user (see CREATE USER) having the same permissions as the faulty user.

  • unsupported frontend protocol 3.51: server supports 1.0 to 3.0

    The database version is too early or the database is an open-source database. Use the driver of the required version to connect to the database.

  • FATAL: GSS authentication method is not allowed because XXXX user password is not disabled.

    In pg_hba.conf of the target DN, the authentication mode is set to gss for authenticating the IP address of the current client. However, this authentication algorithm cannot authenticate clients. Change the authentication algorithm to sha256 and try again. For details, see 5.