Configuring a Data Source in the Windows OS

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

Procedure

  1. Replace the GaussDB(DWS) client driver.

    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).

  2. Open Driver Manager.

    Use the Driver Manager suitable for your OS to configure the data source. (Assume the Windows system drive is drive C.)

    • If you develop 32-bit programs in the 64-bit Windows OS, open the 32-bit Driver Manager at C:\Windows\SysWOW64\odbcad32.exe after you install the 32-bit driver.

      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.

    • If you develop 64-bit programs in the 64-bit Windows OS, open the 64-bit Driver Manager at C:\Windows\System32\odbcad32.exe after you install the 64-bit driver.

      Do not open Driver Manager by choosing Control Panel, clicking Administrative Tools, and clicking Data Sources (ODBC).

    • In a 32-bit Windows OS, open C:\Windows\System32\odbcad32.exe.

      In the Windows OS, click Computer, and choose Control Panel. Click Administrative Tools and click Data Sources (ODBC).

  3. Configure the data source.

    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.

  4. Enable the SSL mode.

    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.

    Table 1 sslmode options

    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.

  5. Add the IP address segment of the host where the client is located to the security group rules of GaussDB(DWS) to ensure that the host can communicate with GaussDB(DWS).

Testing Data Source Configuration

Click Test.

Troubleshooting