Connection String is not being saved correctly

Description

When using above, which was made using cfconfig show datasources in a .cfconfig.json file, the question mark in the dsn key will be replaced with an ampersand. Resulting in this error (in ACF): FATAL: database "MyDatabaseName&stringtype=unspecified" does not exist.

Environment

ACF only as far as I can tell.

Activity

Show:
Brad Wood
March 16, 2020, 6:25 PM

My reply from Slack

So, a few things

  • Firstly for all datasource types other than "other", CFConfig pretty much ignores whatever JDBC URL you give it and uses a default one for that CF engine and DSN type

  • I've never seen {custom} actually put in the URL and I don't think it does anything. We automatically append the custom stuff, which has to be massaged to the proper format for each DSN type anyway

  • You are correct that Lucee provides to way to add additional custom params in the web UI. I don't understand this and it seems like a major issue, but Micha's take has simply been to add actual form fields for all the things he thinks you need, and if you want to toggle any other function, you're just screwed. (Well, unless you use CFConfig to cram it directly in the XML)

  • It's quite likely that CFConfig is using the wrong chars for the JDBC URL Postgres custom bits (some databases want foo=bar&baz=bum while others want foo=bar;baz=bum )

  • Make sure you've got the latest version of CFConfig. I did just massage some of the handling of custom bits a few weeks back

Can you show me

  • what the engine's XML config file needs to contain when the config is stored correctly?

  • What JSON you're using and what XML it curretnly creates?

  • What CF engine version CFConfig is saving for?

 

Brad Wood
March 16, 2020, 6:32 PM

I don’t have a Postgres DB to test any of this on (and not many CFConfig users are on Postgres anyway) but I think I know what the issue was and it was just a simple matter of making sure ? was present at the end of the default URL. The default MySQL URL is

That means when it adds foo=bar to the end, it just works

but the default Postgres URL in CFConfig is

So the “?” never gets added. I’ve added ? to the default URL so with a JSON file with this:

Creates a full URL of this

And the dsn can basically be omitted from your JSON. Like I said, CFConfig ignores those for database types it knows since it can’t use URLs imported from Lucee to Adobe and vice versa. So it always uses a “known good” one and then tacks the custom bits on the end.

Fixed

Assignee

Brad Wood

Reporter

Mingo Hagen

Labels

None

Affects versions

Priority

Minor