diff --git a/core/src/main/java/org/pentaho/di/core/Const.java b/core/src/main/java/org/pentaho/di/core/Const.java
index 50921737901a..331ba348240f 100644
--- a/core/src/main/java/org/pentaho/di/core/Const.java
+++ b/core/src/main/java/org/pentaho/di/core/Const.java
@@ -1657,6 +1657,11 @@ public static String getShimDriverDeploymentLocation() {
*/
public static final String COMPATIBILITY_SHOW_WARNINGS_EXECUTE_EVERY_INPUT_ROW = "COMPATIBILITY_SHOW_WARNINGS_EXECUTE_EVERY_INPUT_ROW";
+ /**
+ Value to Configure if we want to export only the used connections to the XML file
+ */
+ public static final String STRING_ONLY_USED_DB_TO_XML = "STRING_ONLY_USED_DB_TO_XML";
+
/**
* rounds double f to any number of places after decimal point Does arithmetic using BigDecimal class to avoid integer
* overflow while rounding
diff --git a/engine/src/main/java/org/pentaho/di/trans/TransMeta.java b/engine/src/main/java/org/pentaho/di/trans/TransMeta.java
index 253b9af01f8d..8fc0ae7fb835 100644
--- a/engine/src/main/java/org/pentaho/di/trans/TransMeta.java
+++ b/engine/src/main/java/org/pentaho/di/trans/TransMeta.java
@@ -2566,7 +2566,10 @@ public String getXML( boolean includeSteps, boolean includeDatabase, boolean inc
if ( includeDatabase ) {
for ( int i = 0; i < nrDatabases(); i++ ) {
DatabaseMeta dbMeta = getDatabase( i );
- if ( props != null && props.areOnlyUsedConnectionsSavedToXML() ) {
+ //PDI-20078 - If props == null, it means transformation is running on the slave server. For the
+ // method areOnlyUsedConnectionsSavedToXMLInServer to return false, the "STRING_ONLY_USED_DB_TO_XML"
+ // needs to have "N" in the server startup script file
+ if ( props != null && props.areOnlyUsedConnectionsSavedToXML() || props == null && areOnlyUsedConnectionsSavedToXMLInServer() ) {
if ( isDatabaseConnectionUsed( dbMeta ) ) {
retval.append( dbMeta.getXML() );
}
@@ -2621,6 +2624,11 @@ public String getXML( boolean includeSteps, boolean includeDatabase, boolean inc
return XMLFormatter.format( retval.toString() );
}
+ public boolean areOnlyUsedConnectionsSavedToXMLInServer() {
+ String show = System.getProperty( Const.STRING_ONLY_USED_DB_TO_XML, "Y" );
+ return "Y".equalsIgnoreCase( show ); // Default: save only used connections
+ }
+
/**
* Parses a file containing the XML that describes the transformation. No default connections are loaded since no
* repository is available at this time. Since the filename is set, internal variables are being set that relate to
diff --git a/engine/src/main/resources/kettle-variables.xml b/engine/src/main/resources/kettle-variables.xml
index 535ea84524ae..8509e86c4c21 100644
--- a/engine/src/main/resources/kettle-variables.xml
+++ b/engine/src/main/resources/kettle-variables.xml
@@ -663,5 +663,4 @@
COMPATIBILITY_SHOW_WARNINGS_EXECUTE_EVERY_INPUT_ROW
Y
-