malllory.woods
06/01/2023, 1:51 PM# Database Information
DB_CONNECTIONSTRING="jdbc:macromedia:<sqlserver://localhost:1433>;databaseName=shadow;SelectMethod=direct;sendStringParametersAsUnicode=false;querytimeout=0;MaxPooledStatements=100;jdbcbehavior=0"
DB_CLASS=macromedia.jdbc.MacromediaDriver
DB_DRIVER=MSSQLServer
DB_HOST=localhost
DB_PORT=1433
DB_DATABASE=customers
DB_SCHEMA=shadow
DB_USER=sa
DB_PASSWORD=MyDBPASSWORD
So what happens is, that a DSN named customers is setup which is what I want however, the database name should be shadow but its set as customers. I have to manually change it to shadow. Is there a setting that I am missing or have misconfigured?garciadev
06/01/2023, 2:02 PMDB_DATABASE=customers Can you change that to the correct database name? Also, should the DB_SCHEMA be shadow or dbo?malllory.woods
06/01/2023, 2:04 PMgarciadev
06/01/2023, 2:05 PMreload or r from the box command linemalllory.woods
06/01/2023, 2:07 PMmalllory.woods
06/01/2023, 2:09 PMgarciadev
06/01/2023, 2:36 PMgarciadev
06/01/2023, 2:37 PMDB_DSN=whatever and then update the cfconfig accordinglygarciadev
06/01/2023, 2:37 PMbdw429s
06/01/2023, 4:02 PMif you are changing env values, you may need to reload the CommandBox shell.This is not correct. CommandBox never caches env vars. There was a bug in the migrations module specifically that used to cache env var information, but Eric fixed that at ITB 🙂
garciadev
06/01/2023, 4:04 PMbdw429s
06/01/2023, 4:04 PM.cfconfig.json file
• do you have other CFConfig settings in your server.json
• Are you using any cfconfig_xxx env vars
• Are you using a .env file?
• Do you have ${} placeholders in an of your JSON files
As you can see there are a great many possibllities here and we're all just making guesses until we understand where exactly your config is and how it's being loaded.garciadev
06/01/2023, 4:04 PMmay just in case 🙂malllory.woods
06/01/2023, 4:05 PMmalllory.woods
06/01/2023, 8:08 PMmalllory.woods
06/01/2023, 8:09 PM{
"cacheDefaultObject":"coldbox",
"debuggingEnabled":true,
"debuggingReportExecutionTimes":false,
"disableInternalCFJavaComponents":false,
"requestTimeoutEnabled":true,
"requestTimeout":"0,0,5,0",
"robustExceptionEnabled":true,
"caches":{
"coldbox":{
"storage":"true",
"type":"RAM",
"custom":{
"timeToIdleSeconds":"1800",
"timeToLiveSeconds":"3600"
},
"class":"lucee.runtime.cache.ram.RamCache",
"readOnly":"false"
}
},
"datasources" : {
"${DB_DATABASE}":{
"bundleName": "${DB_BUNDLENAME}",
"bundleVersion": "${DB_BUNDLEVERSION}",
"class":"${DB_CLASS}",
"connectionLimit":"100",
"connectionTimeout":"1",
"custom":"useUnicode=true&characterEncoding=UTF8&serverTimezone=UTC&useLegacyDatetimeCode=true&autoReconnect=true&useSSL=false",
"database":"${DB_DATABASE}",
"dbdriver":"${DB_DRIVER:MySQL}",
"dsn":"jdbc:mysql://{host}:{port}/{database}",
"host":"${DB_HOST:127.0.0.1}",
"password":"${DB_PASSWORD}",
"port":"${DB_PORT:3306}",
"username":"${DB_USER:root}",
"storage":"false"
}
},
"whitespaceManagement":"white-space-pref"
}malllory.woods
06/01/2023, 8:09 PMbdw429s
06/01/2023, 8:12 PMbdw429s
06/01/2023, 8:12 PMI am not using CFConfig, I do have a .cfconfig.json fileSo you aren't... but you are??
bdw429s
06/01/2023, 8:12 PMI am not using any env variables, I do have a .env fileAgain, so you aren't, but you are??
malllory.woods
06/01/2023, 8:12 PMbdw429s
06/01/2023, 8:12 PMI don't have any place holders in the JSON filesThen, what are these??
"class":"${DB_CLASS}",malllory.woods
06/01/2023, 8:14 PMbdw429s
06/01/2023, 8:14 PM.env file)
• You are using en var placeholders in your JSON file
So, you the overall fix here is simply to update the JSON/env vars appropriate to have whatever values it is you desire.bdw429s
06/01/2023, 8:15 PMI thought those .cfconfig fields were just generated automatically... I haven't modified themWhether they were created by you or the same aliens who build the pyramids, that doesn't mean you're not using it 🙂
malllory.woods
06/01/2023, 8:15 PMgarciadev
06/01/2023, 8:15 PMgarciadev
06/01/2023, 8:15 PMbdw429s
06/01/2023, 8:17 PMcommandbox-cfconfig and commandbox-dotenv modules are installed (which they are be default in the newest version of CommandBox)
• Any file called .cfconfig.json in the web root will be automatically imported into your server every time you start it.
• Any properties in a file called .env, if it exists in your web root or the working directory of the shell where you ran the start command, will automatally be loaded to the CLI as env vars
• Any ${foo} placeholders in any JSON files will be replaced with the matching env vars, if they existbdw429s
06/01/2023, 8:18 PMgarciadev
06/01/2023, 8:19 PMDB_DSN=whatever and then update the cfconfig accordingly. So instead of
"datasources" : {
"${DB_DATABASE}":{garciadev
06/01/2023, 8:19 PM"datasources" : {
"${DB_DSN}":{garciadev
06/01/2023, 8:20 PMmalllory.woods
06/01/2023, 8:20 PMbdw429s
06/01/2023, 8:20 PMbdw429s
06/01/2023, 8:20 PMgarciadev
06/01/2023, 8:21 PMmalllory.woods
06/01/2023, 8:21 PMbdw429s
06/01/2023, 8:21 PMgarciadev
06/01/2023, 8:21 PMgarciadev
06/01/2023, 8:21 PMbdw429s
06/01/2023, 8:22 PMbdw429s
06/01/2023, 8:23 PM"bundleName": "${DB_BUNDLENAME}",
"bundleVersion": "${DB_BUNDLEVERSION}",
"class":"${DB_CLASS}",
those aren't even necessary in 95% of cases. I would have omitted them entirely from the examplegarciadev
06/01/2023, 8:23 PMbdw429s
06/01/2023, 8:23 PMbdw429s
06/01/2023, 8:23 PMgarciadev
06/01/2023, 8:23 PMbdw429s
06/01/2023, 8:23 PMgarciadev
06/01/2023, 8:24 PMmalllory.woods
06/01/2023, 8:24 PMgarciadev
06/01/2023, 8:25 PMgarciadev
06/01/2023, 8:26 PMbdw429s
06/01/2023, 8:27 PMgarciadev
06/01/2023, 8:28 PMbdw429s
06/01/2023, 8:28 PMgarciadev
06/01/2023, 8:28 PMmalllory.woods
06/01/2023, 8:28 PMbdw429s
06/01/2023, 8:29 PM