Advantage Client Engine
Sets one property associated with a database user in the data dictionary.
UNSIGNED32 AdsDDSetUserProperty( ADSHANDLE hDBConn,
UNSIGNED8 *pucUserName,
UNSIGNED16 usPropertyID,
VOID *pvProperty,
UNSIGNED16 usPropertyLen );
hDBConn (I) |
Handle of a database connection. |
pucUserName (I) |
Name of the database user object to set the associated property. |
usPropertyID (I) |
Index of a database user property to set. See Remarks for allowed values. |
pvProperty (I) |
Pointer to the buffer where the property is stored. |
usPropertyLen (I) |
The size of the property specified by the pvProperty. |
AE_INVALID_OBJECT_NAME |
Possible cause for the error is that the pucUserName does not specify a valid user name in the database. |
AE_INVALID_PROPERTY_ID |
Either the value supplied in usPropertyID is not a valid database user property ID, or the specified property cannot be set. |
AdsDDSetUserProperty sets one user property associated with the specified user. The new property overwrites the existing property in the data dictionary.
ALTER permissions on the user are required to modify data dictionary user properties. See Advantage Data Dictionary User Permissions for more information.
Note This function can be called inside a transaction, but will not be part of the transaction. Any changes it makes cannot be rolled back.
The following are the valid values of usPropertyID and the expected value in pvProperty and usPropertyLen.
usPropertyID |
Description |
ADS_DD_COMMENT |
Stores a new description for the user. The pvProperty is expected to be NULL terminated string. usPropertyLen is the length of the string including the NULL terminator. If pvProperty is NULL or empty string, the user description is removed. |
ADS_DD_USER_DEFINED_PROP |
Changes the user defined user property. If pvProperty is NULL, the user defined user property is removed. User defined property is set, read, and interpreted by the application. It is not used by the Advantage Database Server or the Advantage Local Server. |
ADS_DD_USER_PASSWORD |
Sets a new password for this user. The user password is used by the Advantage Database Server or the Advantage Local Server to authenticate a user when he makes a connection to the database. See AdsConnect60 for more information on database connections. pvProperty is expected to be a NULL terminated string. usPropertyLen is the length of the string including the NULL terminator. To allow the user to connect without a password, specify NULL or an empty string as pvProperty. The maximum length of the password not including the NULL terminator is 20 characters. If usPropertyLen is longer than 21, the first 20 character will be used as the password. ADS_DD_USER_PASSWORD can be used to set the administrator password by specifying the ‘ADSSYS’ as the user name. |
ADS_DD_ENABLE_INTERNET |
This property enables/disables the Internet access for the user. If it is disabled, the user will be allowed to connect from the Internet. pvProperty is expected to be a pointer to a 2-byte (UNSIGNED16) integer. usPropertyLen is expected to be 2. Expected values are True and False. For more information see Advantage Internet Server. A user cannot change this setting for themselves. Only a separate user with ALTER permissions for this user can change this property. |
ADS_DD_LOGINS_DISABLED |
This property enables/disables the database login for the user. If it is enabled, the user will not be allowed to login to the database. The default setting is disabled (the user is allowed to login). pvProperty is expected to be a pointer to a 2-byte (UNSIGNED16) integer. usPropertyLen is expected to be 2. Expected values are True and False. |
Note When the database is created, by default it allows anonymous users to make a database connection with no user name and no password. Setting the ADS_DD_LOG_IN_REQUIRED database property to True will disable the anonymous user connections and improve the database security. See AdsDDSetDatabaseProperty for more information.
After making a connection to the database, set a new password for user ‘User1’.
AdsConnect60( "n:\\MyData\\myData.ADD", ADS_REMOTE_SERVER, "ADSSYS", NULL, ADS_DEFAULT, &hDD );
ulReturnCode = AdsDDSetUserProperty( hDD, "User1", ADS_DD_USER_PASSWORD, "Super secret", 13 );