I am getting this error when adding sql server dsn

I used commandbox to start coldfusion 2021 and I can’t add sql server dsn. It works on coldfusion 2016 on command box. My commandbox version is v5.4.2+00453

I was able to make it work by adding an environment variable JAVA_HOME with the value of the location of the jre directory. i was able to execute: /WEB-INF/cfusion/bin/cfpm.bat install sqlserver

It’s much easier than that. CommandBox already has a cfpm command that properly handles the java home. Just cd into the webroot and run

Cfpm install xyz
1 Like

I will give it a try. Thanks

cfpm works! Nice. Thank you so much

1 Like

Hey, Brad. On this matter, is it that one has to run cfpm that way to add modules to a Commandbox CF engine? I presumed there may be a server.json setting or env var way to simply name them (to have it pull in and implement them), versus running cfpm itself.

I know that the Ortus CF container images support a cfpm_install env var for simply naming them (to be pulled in and implemented), just like the Adobe CF images support that via their installModules env var.

Is it just there’s not yet been enough call for their manipulation yet in regular Commandbox engines? that running this cfpm command has been enough for most, perhaps scripting that? I appreciate that it can do more than JUST add modules.

I appreciate also that there’s more to the CF package/module install process than meets the eye, and perhaps it’s such “other” issues which have held up more complete adoption. Asking here as much for the sake of others, who may find this thread in the future. (If it was discussed elsewhere, feel free to point us there.) Thanks.

1 Like

Sorry, I don’t understand what you’re asking. People are free to install Adobe modules however they want. The cfpm command in CommandBox is simply a passthrough provided for your convenience to the underlying shell script/batch file inside the Adobe home that also ensures java_home is set.

While Jon added an env var to our Ortus docker images to install cfpm modules, there is not a first-class env var in CommandBox proper. I had REALLY hoped Adobe would bake that into the core of ACF itself like Lucee Server. I asked on several occasions and I don’t think they were too interested :person_shrugging:

My recommended approach for CommandBox users wanting to automate the installation of adobe CF modules is to put the following in your server.json:

{
  "scripts" : {
    "onServerInitialInstall" : "cfpm install foo,bar,baz"
  }
}

CommandBox will run that script the first time it deploys the CF engine.

Which, come to think of it, you could use CommandBox’s generic syntax for overriding server.json values with the following env var if you want:

box_server_scripts_onServerInitialInstall=cfpm install foo,bar,baz

Lots of ways to skin the cat.

1 Like

That’s a workaround that may satisfy everyone, sure. So thanks for that.

More plainly, I simply wondered if you’d considered adding something as simple as cfpm_install for Commandbox itself (rather than only for the images), to simply name modules to be installed.

I get it that Adobe didn’t have it for you to leverage (other than their env var for images).

Or do you think I’m still confused (or confusing you) on that point?

1 Like

I think the server script IS simple :slight_smile: It’s elegant, works everywhere CommandBox is used, and is already a part of the CommandBox core without needing to add any addition features. And the env var convention is there there for anyone who wants it, also being simple, easy to use, and already part of CommandBox. I think if I start adding a bunch of custom things for specific scenarios, it just turn into a bit of a mess.

In reality, CommandBox supports an infinite number of env variables for overriding

Almost none of them are hard-coded one-off variable names. They follow predicable conventions to expose every possible setting which already exists.

Since running cfpm is already made very simple, and automating that execution can be done quite easily by wiring together a server lifecycle script, I like to leave it like that.

1 Like

It’s your decision to make, of course. I only brought it up in the context of Jojo’s request, and then your answer (to run cfpm install), when I went looking for any more dedicated config solution. I’d seen the onServerInitialInstall and thought perhaps I was missing something.

It (a dedicated mechanism to address this fundamental feature of CF’s design in 2021-on) seemed like the kind of thing Commandbox MIGHT have added, so I just wanted to make sure I wasn’t missing it. I’ll admit I was surprised that you didn’t “understand what I was asking”, which is why I pressed on.

It’s clear now where things stand, for anyone who’d wonder and may find this discussion. That’s a helpful conclusion. Again, thanks.

2 Likes

Thanks guys I hope this helps others when using commandbox running cf 2021

1 Like