DEV Community

leo
leo

Posted on

ODBC configuration file parameter description (openGauss)

  1. Configure the data source file:

Add the following content to the "/usr/local/etc/odbc.ini" file.

[MPPODBC]
Driver=GaussMPP
Servername=10.145.130.26 (database Server IP)
Database=postgres (database name)
Username=omm (database user name)
Password= (database user password)
Port=8000 (database listening port)
Sslmode=allow

  1. Description of odbc.ini file configuration parameters:

parameter

describe

example

[DSN]

The name of the data source.

[MPPODBC]

driver

Driver name, corresponding to DriverName in odbcinst.ini.

Driver=DRIVER_N

Servername

The IP address of the server.

Servername=10.145.130.26

Database

The name of the database to connect to.

Database=postgres

Username

Database user name.

Username=omm

Password

Database user password.

Password=

illustrate:

The ODBC driver itself has cleaned up the memory password to ensure that the user password will not be kept in the memory after connection.

However, if this parameter is configured, because UnixODBC caches data source files, etc., the password may be kept in memory for a long time.

It is recommended to pass the password to the corresponding API instead of writing it in the data source configuration file when the application connects. At the same time, after the connection is successful, the memory segment storing the password should be cleaned up in time.

port

The port number of the server.

Port=8000

Sslmode

Enable SSL mode

Sslmode=allow

Debug

When set to 1, the mylog driven by psqlodbc will be printed, and the log generation directory is /tmp/. When set to 0, it will not be generated.

Debug=1

UseServerSidePrepare

Whether to enable the extended query protocol on the database side.

The optional value is 0 or 1, and the default is 1, which means to open the extended query protocol.

UseServerSidePrepare=1

UseBatchProtocol

Whether to enable the batch query protocol (opening can improve DML performance); the optional value is 0 or 1, and the default is 1.

When this value is 0, the bulk query protocol is not used (mainly for communication compatibility with earlier database versions).

When this value is 1, and the database support_batch_bind parameter exists and is on, the batch query protocol will be turned on.

UseBatchProtocol=1

ForExtensionConnector

This switch controls whether the savepoint is sent, and you can pay attention to this switch for savepoint-related issues.

ForExtensionConnector=1

UnnamedPrepStmtThreshold

Every time SQLFreeHandle is called to release Stmt, ODBC will send a Deallocate plan_name statement to the server, and there are many such statements in the business. In order to reduce the sending of such statements, we set stmt->plan_name to be empty, so that the database recognizes this as unnamed stmt. Increase this parameter to control the threshold of unnamed stmt.

UnnamedPrepStmtThreshold=100

ConnectionExtraInfo

The GUC parameter connection_info displays the switch of the driver deployment path and the process owner user.

ConnectionExtraInfo=1

illustrate:

The default value is 0. When set to 1, the ODBC driver will report the current driver deployment path and process owner user to the database, and record it in the connection_info parameter; at the same time, it can be queried in PG_STAT_ACTIVITY.

BoolAsChar

If set to Yes, Bools values ​​will be mapped to SQL_CHAR. If not set, it will be mapped to SQL_BIT.

BoolsAsChar = Yes

Row Versioning

When trying to update a row of data, setting it to Yes will allow the application to detect whether the data has been modified by another user.

RowVersioning=Yes

ShowSystemTables

The driver will default the system tables to normal SQL tables.

ShowSystemTables=Yes

Top comments (0)