Have you confirmed first that a simple single variable assignment works? How about a simpler sql statement, without the queryparam?
And what cf version are you running? And what update level? That will help folks see if they get the same problem. (Of course, they'd not have your database.)
I'll assume also that the dsn you name is defined in the cf admin of the instance whose CLI you're running. Have you confirmed also that just running that code in a cfscript block of a regular cfm page (requested by a browser or the cf.bat file) does work?
Breaking your problem into pieces is the way to solve things like this, which you think "should just work". Only after exhausting such possibilities might it be time to wonder if there's a bug in cf.