How To Set UPDATE_IF_NULL in grloader when the data source is JDBC?

Document ID : KB000029060
Last Modified Date : 14/02/2018
Show Technical Document Details

DESCRIPTION: This document will show in how to pass update certain fields with null values when using jdbc

 

SOLUTION:

We are going to use an example in how to go about achieving this:

The basic thought is to have the mac address value replaced with the string 'EMPTY' and run the grloader so that we achieve the requirement.

1) Login as SDM -> Administration->CMDB-> CI transactions -> create a new CI transaction with following attributes.

Name=test
Mac address=12232343425345
System name=sdm-se-team556
Class= AIX

2) Run the following command GR loader:

GRLoader -dbdriver com.microsoft.sqlserver.jdbc.SQLServerDriver -dburl jdbc:sqlserver://localhost:1433;databaseName=mdb; -dbuser ServiceDesk -dbpswd Service123Desk -s http://localhost:8080  -a -n -E -u ServiceDesk -p Password -dbstmt "SELECT name,class,mac_address,system_name from ci_twa_ci " -e jdbc_err.xml

This will now create a CI with Mac address=12232343425345

3) Update the Value of the Mac address= EMPTY from CI transaction created in step 1.

4) Run the same GRloader command in Step-2 which will update the Mac address to null.