Configure the ODBC data source using the ODBC data source manager preinstalled in the Windows OS.
Decompress GaussDB-8.1.1-Windows-Odbc.tar.gz and install psqlodbc.msi (for 32-bit OS) or psqlodbc_x64.msi (for 64-bit OS).
Use the Driver Manager suitable for your OS to configure the data source. (Assume the Windows system drive is drive C.)
Do not open Driver Manager by choosing Control Panel, clicking Administrative Tools, and clicking Data Sources (ODBC).
WoW64 is the acronym 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.
Do not open Driver Manager by choosing Control Panel, clicking Administrative Tools, and clicking Data Sources (ODBC).
In the Windows OS, click Computer, and choose Control Panel. Click Administrative Tools and click Data Sources (ODBC).
On the User DSN tab, click Add, and choose PostgreSQL Unicode for setup. (An identifier will be displayed for the 64-bit OS.)
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.
To use SSL certificates for connection, decompress the certificate package contained in the GaussDB(DWS) installation package, and double-click the sslcert_env.bat file to deploy certificates in the default location.
The sslcert_env.bat file ensures the purity of the certificate environment. When the %APPDATA%\postgresql directory exists, a message will be prompted asking you whether you want to remove related directories. If you want to remove related directories, back up files in the directory.
Alternatively, you can copy the client.crt, client.key, client.key.cipher, and client.key.rand files in the certificate file folder to the manually created %APPDATA%\postgresql directory. 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.
Change the value of SSL Mode in step 2 to verify-ca.
sslmode |
Whether SSL Encryption Is Enabled |
Description |
---|---|---|
disable |
No |
The SSL secure connection is not used. |
allow |
Probably |
The SSL secure encrypted connection is used if required by the database server, but does not check the authenticity of the server. |
prefer |
Probably |
The SSL secure encrypted connection is used as a preferred mode if supported by the database, but does not check the authenticity of the server. |
require |
Yes |
The SSL secure connection must be used, but it only encrypts data and does not check the authenticity of the server. |
verify-ca |
Yes |
The SSL secure connection must be used, and it checks whether the database has certificates issued by a trusted CA. |
verify-full |
Yes |
The SSL secure connection must be used. In addition to the check scope specified by verify-ca, it checks whether the name of the host where the database resides is the same as that on the certificate. NOTE:
This mode cannot be used. |
Click Test.
This problem occurs because when verify-full is used for SSL encryption, the driver checks whether the host name in certificates is the same as the actual one. To solve this problem, use verify-ca to stop checking host names, or generate a set of CA certificates containing the actual host names.
Check the Servername and Port configuration items in data sources.
If Servername and Port are correctly configured, ensure the proper network adapter and port are monitored based on database server configurations in the procedure in this section.
Check firewall settings, ensuring that the database communication port is trusted.
Check to ensure network gatekeeper settings are proper (if any).
Possible cause: The bit versions of the drive and program are different.
C:\Windows\SysWOW64\odbcad32.exe is a 32-bit ODBC Drive Manager.
C:\Windows\System32\odbcad32.exe is a 64-bit ODBC Drive Manager.
sslmode is not configured for the data source. Set this configuration item to allow or a higher level to enable SSL connections. For details about sslmode, see Table 1.
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.
To solve this problem, you can update the user password. For details, see "ALTER USER" in the SQL Syntax. Alternatively, create a user (see "CREATE USER" in the SQL Syntax), assign the same permissions to the user, and use the new user to connect to the database.
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.