FB_DBOdbcConnectionAdd

FB_DBOdbcConnectionAdd 1:

The function block FB_DBOdbcConnectionAdd can be used to add further ODBC database connections to the XML configuration file.

VAR_INPUT

VAR_INPUT
    sNetID       :T_AmsNetId;
    eDBType      :E_DBTypes;
    eDBValueType :E_DBValueType;
    sDBDriver    :T_MaxString;
    sDBServer    :T_MaxString;
    sDBDatabase  :T_MaxString;
    nDBPort      :UDINT;
    sDBProtocol  :T_MaxString;
    sDBUserId    :T_MaxString;
    sDBPassword  :T_MaxString;
    sDBScheme    :T_MaxString;
    sDBSequence  :T_MaxString;
    sDBClientDll :T_MaxString;
    sDBTable     :T_MaxString;
    bExecute     :BOOL;
    tTimeout     :TIME;
END_VAR

sNetID: String containing the AMS network ID of the target device, at which the ADS command is directed.

eDBType: Indicates the type of the database, e.g. 'Mobile server'.

eDBValueType: Indicates the form in which the values are or will be stored.

sDBDriver: Indicates the name of the ODBC driver to be used.

sDBServer: Indicates the name of the server.

sDBDatabase: Indicates the name of the database.

nDBPort: Indicates the port for the ODBC connection.

sDBProtocol: Indicates the protocol to be used (TCPIP).

sDBUserId: Indicates the user name.

sDBPassword: Indicates the password to be used.

sDBScheme: Indicates the database schema to be used.

sDBSequence: Indicates the sequence name for Oracle databases.

sDBClientDll: Contains the path to fbclient.dll. (Only for Firebird/Interbase databases)

sDBTable: Gives the name of the table into which the values are to be written.

bExecute: The command is executed with a rising edge.

tTimeout: Indicates the time before the function is cancelled.

VAR_OUTPUT

VAR_OUTPUT
    bBusy  : BOOL;
    bError : BOOL;
    bErrID : UDINT;
    hDBID  : UDINT;
END_VAR

bBusy: The command is in the process of being transmitted by ADS. No new command will be accepted as long as bBusy remains TRUE.

bError: Becomes TRUE, as soon as an error occurs.

nErrID: Returns the ADS error code if the bError output is set.

hDBID: Returns the ID of the database.

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v3.0.0

PC or CX (x86)

Tc2_Database