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 double-click psqlodbc.exe (32-bit) to install the driver.
- Open 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 OS. 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.
Copy the client.crt, client.key, client.key.cipher, and client.key.rand files to the manually created directory %APPDATA%\postgresql. Change client in the file names to postgres, for example, change client.key to postgres.key. Copy the cacert.pem file to the %APPDATA%\postgresql directory and change its name to root.crt.
%APPDATA% is located in C:\Users\[username]\AppData by default, and its values is specified by customers during installation.
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 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 on the certificate. Currently, Windows ODBC does not support cert authentication.
Verifying the Data Source Configuration
Click Test.
Troubleshooting
- connect to server failed: no such file or directory
- 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 NIC and port are monitored based on 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 connection. For details about 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 old 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.
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