Executing a database command
This topic is divided into the following sections:

Overview of the Database Command Process

The JdbcSource applet executes non-retrieval database operations (such as Insert, Delete, and Update) by connecting to an external database and using the commands HTML parameter. Commands are executed at runtime by setting an incoming command "trigger" data item to true. This trigger item is implicitly created by defining the original command with a PARAM tag. Click here for more information on these "trigger" data items.

Sample HTML for executing a database command

The following sample HTML code shows the PARAM tags needed to execute a non-retrieval command operation with the JdbcSource applet.

Two commands are defined, "NewEmp" and "EmpDeptChanged". "NewEmp" inserts a new employee's last name, first name, and employee into a new database record. "EmpDeptChanged" updates the employee department information for a specified employee record.


<APPLET NAME="dataBase1" CODEBASE="..\..\.." CODE="lotus.jdbc.JdbcSource" WIDTH=1 HEIGHT=1>
<!-- Configuration setup tags begin here -->
<PARAM NAME="driver" VALUE="JDBC driver classname"> <PARAM NAME="autoload" VALUE="true"> <PARAM NAME="database" VALUE="databaseURL"> <PARAM NAME="user" VALUE="databaseID"> <PARAM NAME="password" VALUE="databasePassword"> <PARAM NAME="autoconnect" VALUE="true">
<!-- Command tags begin here -->
<PARAM NAME="commands" VALUE="NewEmp, EmpDeptChange"> <PARAM NAME="NewEmp" VALUE="insert into employee(lastname, firstname, id) values(%ln%, %fn%, %id%)"> <PARAM NAME="EmpDeptChange" VALUE="exec sp_emp_change(%id%, %oldDept%, %newDept%">


The following JdbcSource PARAM tags specify the options while executing the database commands used in this example. Tag options are specified by the NAME attribute and option values are specified by the VALUE attribute of the tag.

Within the APPLET tag, the various attributes do the following:

Data items defined during the execution of the database command operations

By defining two commands ("NewEmp" and "EmpDeptChange") in the example, the following data items are also implicitely defined and used during the command operations:

Data Items for the NewEmp command:

Data Item Name Type Description
NewEmp.trigger In Causes "NewEmp" command to be executed when set to true
ln In Employee last name
fn In Employee first name
id In Employee ID
NewEmp.status Out Contains status of the "NewEmp" command (initially "no data", later "OK" or an error message)
NewEmp Out Contains the result for the "NewEmp" command. This is the number of data rows affected by the operation. The result is -1 if this is not applicable.

Data Items for the EmpDeptChange command:

Data Item Name Type Description
EmpDeptChange.trigger In Causes the "EmpDeptChange" command to be executed when set to true
id In Employee ID
oldDept In Employee's old department
newDept In Employee's new department
EmpDeptChange.status Out Contains the status of the "EmpDeptChange" command (initially "no data", later "OK" or an error message)
EmpDeptChange Out Contains the result for the "EmpDeptChange" command. This is the number of data rows affected by the operation. The result is -1 if this is not applicable.