I don't think I had any extra spaces in there.
Managed to figure out the following.
IBM DB2 Type 2 driver does not work from Datasource step as it does not support user and password attributes in the URL.
so this driver won't work: COM.ibm.db2.jdbc.app.DB2Driver (db2java.jar) from Datasource step. (It works from a groovy script)
Instead IBM DB2 Type 4 driver (db2jcc.jar) does work:
com.ibm.db2.jcc.DB2Driver and connection URL:
jdbc:db2:[//server:port/]database:user=XXX;password=XXX;
Also quotes around the SQL in the SQL field cause an exception to be thrown.