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
- Replace the GaussDB client driver.
Decompress GaussDB-Kernel_VxxxRxxxCxx-Windows-Odbc.tar.gz and install psqlodbc.exe (for the 32-bit OS) as required.
- Open the driver manager.
Use the ODBC Driver Manager for the 32-bit OS to configure the data source. (Currently, only the ODBC Driver Manager for the 32-bit OS is supported. The following description assumes that the OS is installed on drive C. If the OS is installed on another drive, change the path accordingly.)
- For 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, open C:\Windows\SysWOW64\odbcad32.exe. Do not choose Control Panel > Administrative Tools > Data Sources (ODBC).
- Configure a data source.
On the User DSN tab, click Add and choose PostgreSQL Unicode for setup.
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.
- Enable the SSL mode.
Change the value of SSL Mode in 3 to require.
Table 1 sslmode options and description 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 cert 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 cert authentication.
- Configure the GaussDB server. Contact an administrator for details.
- Run the following commands to restart the cluster:
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.

- When ODBC is used to connect to a database, the kernel parameters are set as follows:
SET extra_float_digits = 2; SET DateStyle = 'ISO';
These parameters may cause the ODBC and gsql clients to display inconsistent data in aspects such as date data display mode and floating-point precision representation. If the result is not as expected, you are advised to explicitly set these parameters in the ODBC application code.
FAQ
- connect to server failed: no such file or directory
- An incorrect or unreachable database IP address or port was configured.
Check the Server and Port configuration items in data sources.
- Server monitoring is improper.
If Server and Port are correctly configured, ensure the proper NIC 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).
- An incorrect or unreachable database IP address or port was configured.
- The password-stored method is not supported.
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 CN, 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot