Re: RFI: Database URIs
"David E. Wheeler" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase.devel |
|---|---|
| Message-ID | <[email protected]> |
On Nov 22, 2013, at 8:48 PM, Darren Duncan <[email protected]> wrote: >> postgresql://user@localhost:5433/dbname >> sqlite:///path/to/foo.db > > By "database name" do you mean "DBMS name"? Because I'd say the "database name" is what's on the right-hand side of the //, not what's on the left. Yes, correct. > Another thing I was going to say is, if you wanted some standardization, you should distinguish the parts that are necessary to connect to a database from parts that just select a default schema in the database for interacting with. Getting a bit OT from my original questions here. But anyway, I’m following the JDBC and PostgreSQL examples here, where, frankly, are almost identical to most other URLs. This is a very good thing. > By that I mean, remember that a PostgreSQL "database" and a MySQL "database" aren't actually the same concept. A PostgreSQL DBMS server gives access to multiple disjoint databases where you must name one to connect, and then separately from that is the optional concept of the current schema that you can select. A MySQL DBMS server gives access to exactly 1 database, which you can connect to without specifying a "database name", and selecting a current schema (what they call a "database") is optional for using MySQL. While I agree that a PostgresSQL database and a MySQL database are not the same thing, the MySQL community still calls it a database and tends to think of it that way, and JDBC has set the precedent for relying on what the community calls a “database” to be the “database” part of the URL: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html > The reason I say this is that DBI's uri scheme uses the same syntax for both "database" even though how they're treated is actually very different. And you don't have to do the same. I don’t have to, but that ship has long since sailed, so I will treat them the same as the DBI and JDBC. Best, David