I wish there was a library for "every" that took a standardized connection string and mapped it to "every" DB/storage/queue/etc client. This is one of those things that should be a solved problem that we as an industry should just move past having to deal with.
This would obviously be too much effort to actually do but it would save a lot of headache. "We can't X because we cant pass it's config to the software"
> I wish there was a library for "every" that took a standardized connection string and mapped it to "every" DB/storage/queue/etc client.
This has been around for like 30 years, it's called ODBC. As long as you're using an ODBC driver the strings are the same (modulo the driver specification).
Intuitively you would think so, but unfortunately not. The ODBC specification last time I looked into it doesn't dictate the key-values that is given to the database driver so it's up to each driver to pick it's own. E.g. HOSTNAME vs SERVER, or PASSWORD vs PWD are the two main differences I recall.
I'm not super well-versed in it, so I'm sure someone else here can provide more detail as to why it's different or if there is history behind it being like this. But from a dev's perspective, ODBC connection strings are an absolute mess. Not to mention no one really knows what's what, hence this website. Fun fact, I tried to find the spec as part of responding here and I couldn't find it. Best I could find was this: https://docs.microsoft.com/en-us/sql/odbc/reference/develop-...
But you go around finding actual details and next thing you know it's under the heading of "SQL Server XXXX" so you have no idea if it's the "spec" or just the MS SQL Server driver reference.
In my experience, while it sounds nice to be able to swap out databases with just a config change, it really takes code changes even with an ORM. I recently wrote an app that can use either SQLlite or MS SQL with EF Core. Many things are the same, but there are some queries that I have to handle differently between providers. If I were to add mongo or similar I’d definitely have more changes.
I do choose the provider based on the connection string though :)
Or “we had to restart 7 times because I thought I knew the syntax, but it didn’t seem taken into account, so I changed it 6 more times and actually the second time was correct but needed a second parameter.”
Hum... Oracle has its service names and SID, MS SQL server has instances, PostgreSQL is actually what you'd expect from a network server, SQLite is obviously completely different from anything else. I don't remember the MySQL connection parameters, but I remember the username is a crazy multi-part string.
And that's just the basic connection parameters, you will want to set some advanced ones once in a while. I don't see what you gain by creating an universal interface, since they are all completely different from each other.
Using a schema that allows you to specify a different parser for the remainder of the string would fix this. Like: sqlite:// and redis://. You could the have standards for common things like usernames, passwords, hosts, ports, and storage path.
IMHO the connection strings are exactly a thing that should have been standardized, in form of a URL preferably. I have invented my own URL forms and implemented code parsing them and providing connections quite a number of times in many languages.
I disabled ad block to see what you were on about. There is one little slide up banner at the bottom that you can close. If you don't have an adblock (mine disabled that), how is this ad-laden to you?
None here on Chrome+adblocker. I turned off the ad blocking just to see how bad it was - 1 on the home page, 2 on connection string pages. Pretty tame all things considered.
This would obviously be too much effort to actually do but it would save a lot of headache. "We can't X because we cant pass it's config to the software"