f2s_connection_user¶

Applies to: Oracle, MS SQL, MySql/MariaDB, PostgreSQL Drivers

Syntax

**There is no set_attribute.  This attribute is read only.**
get_attribute f2s_connection_user of {DriverID} {server} to {variable}

Parameter

Description

DriverID

The ID of the driver for which this applies. In most cases, you should use _f2s_ActiveDriverID.

server

string pointer of the name of the database server

variable

String variable to hold the user name

Description

This read only attribute is used to get the name of the user currently logged into the server. If using a MSSQL server with a trusted connection, this attribute will return blank. If using a trusted connection, you can get the user name with the DataFlex function Network_User_Name (part of the dfabout.pkg).

Examples

get_attribute

String sName sPass sServer
Boolean bNT

Get_Attribute f2s_server of _f2s_ActiveDriverId to sServer

Get_Attribute f2s_connection_user of _f2s_ActiveDriverId (f2s_ConstPointer(sServer)) to sName
If (sName="") begin
    Get Network_User_Name to sName
    Move True to bNT
End
Else Get_Attribute f2s_connection_user_password of _f2s_ActiveDriverID (f2s_ConstPointer(sServer)) to sPass

If (bNT) Showln (SFormat("On server %1, using NT authentication, the user is %2.",sServer, sName))
Else Showln (SFormat("On server %1, the current user is  %2 using password %3.", sServer, sName,sPass))

Related Attributes

  • f2s_connection_user_password

Replaces: Command GET_CURRENT_USER_NAME