ConnectionString property
The value of the ConnectionString property is a connection string that includes the source database name and the parameters you need to establish the connection.
The default value of the ConnectionString property is an empty string. The Server attribute is mandatory in all situations.
The minimum required connection string attributes that must be set for non-DSN connections are Server, Protocol, Service, and Host name. If any of those are missing, the server ignores the remaining attributes and next checks the environmental variables, followed by the values in specified in setnet32.
The following table shows the connection string attributes.
Attribute | Description | Default value |
---|---|---|
Client Locale, Client_Locale | The language locale used on the client side of the client-server connection. | en_us.CP1252 (Windows™) |
Connection Lifetime | When a connection is returned to the pool, the creation time of the connection is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by connection lifetime. | 0 |
Database, DB | The name of the database within the server instance. If no database is specified, a server-only connection is created. You can switch a server-only connection to a database connection by using the ChangeDatabase method. If you use DATABASE... or CREATE DATABASE... statements, you must manage their execution fully, because the HCL® OneDB® .NET Core Provider does not automatically recognize when these commands are issued. Using these statements without proper management can lead to unexpected results. | "" (Empty string) |
Database Locale, DB_LOCALE | The language locale of the database. | en_US.819 |
DELIMIDENT | When set to true or y for yes, any string within double quotes (") is treated as an identifier, and any string within single quotes (') is treated as a string literal. | 'y' |
Enlist | Enables or disables automatic enlistment in a distributed transaction. You can disable automatic enlistment in existing transactions by specifying Enlist=false as a connection string parameter. | true |
Exclusive, XCL | The EXCLUSIVE keyword opens the database in exclusive mode and prevents access by anyone but the current user. If another user has already opened the database, exclusive access is denied, an error is returned, and the database is not opened. Valid values are No, 0, Yes, or 1. | No |
Host | The name or IP address of the machine on which the HCL OneDB server is running. Required. | localhost |
Max Pool Size | The maximum number of connections allowed in the pool. | 100 |
Min Pool Size | The minimum number of connections allowed in the pool. | 0 |
Optimize OpenFetchClose, OPTOFC | Reduces the number of round trips to the server for result-set queries. Recommended only for forward-only retrieval of data. | "" (Empty string) |
Packet Size, Fetch Buffer Size, FBS | The size in bytes of the buffers used to send data to or from the server. Maximum value is 2147483648 (2GB). | 32767 |
Password, PWD | The password associated with the User ID. Required if the client machine or user account is not trusted by the host. Prohibited if a User ID is not given. | "" (Empty string) |
Persist Security Info | When set to false, security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. Resetting the connection string resets all connection string values, including the password. | 'false' |
Pooling | When set to true, the IfxConnection object is drawn from the appropriate pool, or if necessary, it is created and added to the appropriate pool. | 'true' |
Protocol, PRO | The communication protocol used between the CreateConnection() and the database server. | "" (Empty string) |
Server | The name or alias of the instance of the HCL OneDB server to which to connect. Required. | "" (Empty string) |
Service | The service name or port number through which the server is listening for connection requests. | "" (Empty string) |
Single Threaded | If your application is single threaded, you might have better performance with this property. Do not use this option in an XA/MSDTC environment. | 'false' |
Skip Parsing | You can avoid SQL parsing overhead by setting this value to 'true'. However, you must be certain that your queries are correct, otherwise an error will result. | 'false' |
User ID, UID | The login account. Required, unless the client machine is trusted by the host machine. | "" (Empty string) |
You can only set the ConnectionString property when the connection is closed. Some of the connection string values have corresponding read-only properties. When the connection string is set, all of these properties are updated, except when an error is detected. In this case, none of the properties are updated. IfxConnection properties return those settings contained in the ConnectionString as well as default values or values gathered elsewhere.
Resetting the ConnectionString on a closed connection resets all connection string values and related properties, including the password. For example, if you set a connection string that includes "Database=superstores", and then reset the connection string to "Server=myServer", the Database property is no longer set to superstores.
The connection string is parsed immediately after being set. If errors in syntax are found when parsing, a runtime exception, ArgumentException, is returned. Other errors can be found only when an attempt is made to open the connection. If an attribute name occurs more than once in the connection string, the value associated with the last occurrence is used.
The CreateConnection() ConnectionString is not identical to the HCL OneDB ODBC connection string. The connection string that is returned is the same as the one set by the user. Neither the ODBC 'Driver' attribute or the OLE DB 'Provider' attribute are supported.
If you set the Persist Security Info attribute to false (the default), if the connection has ever been opened, the returned connection string will not contain any security information. If the connection has not been opened, the returned connection string does contain security information, regardless of the setting of Persist Security Info. If you set the Persist Security Info attribute to true, the returned connection string contains security information.