I had posted a similar answer at a different post which was largely of a similar nature.
I solved this. The problem was due to two conflicting JREs which I had added into KNIME preferences for database. Hence, when KNIME was being called from Command Prompt, the JRE being referred for the database was creating a problem.
Hence, I removed one of the JRE while retaining JRE 11 and it seems to be working.