<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="20" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[20]</anchor-end> 色々な<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">プログラミング言語</anchor>の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">ライブラリー</anchor>などでは、
接続先の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>やオプションを指定するために、 <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL</anchor>
が用いられています。</p><section><h1>意味</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="21" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[21]</anchor-end> 
そもそも <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL</anchor> の多くは、何らかの意味の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>に接続して情報を得たり、
書き込んだりするものです。例えば <code class="URI" xml:lang="en">https:</code> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL</anchor>
は <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">HTTPS</anchor> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">プロトコル</anchor>を介して<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">ハイパーテキスト</anchor>データベースにアクセスすることを表しています。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="22" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[22]</anchor-end> 本項でいう「データベース」は、それよりも限定されたもので、
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">プログラム</anchor>が情報の保持に用いる<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">関係データベース</anchor>やいわゆる <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">NoSQL</anchor>
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>などです。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="5" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[5]</anchor-end> 本項に該当する <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL</anchor> の多くは、接続先の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>を表しています。
すなわち、<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>へ接続するために必要な<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">プロトコル</anchor>、
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">ホスト</anchor>、<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>名、接続オプションなどを <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL</anchor>
に含めています。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="7" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[7]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>内のデータにまで<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">アドレス付け</anchor>している <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL scheme</anchor>
は今のところなさそうです。</p></section><section><h1>URL scheme</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="4" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[4]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>の種類 (接続<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">プロトコル</anchor>の種類) ごとに、
色々な <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL scheme</anchor> が使われています。</p><figure class="short list"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="2" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[2]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>を表す <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL scheme</anchor></figcaption><ul><li><code class="URI" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">db:</anchor></code></li><li><code class="URI" xml:lang="en">dbase:</code></li><li><code class="URI" xml:lang="en">fbsql:</code></li><li><code class="URI" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">jdbc:</anchor></code></li><li><code class="URI" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">mysql:</anchor></code></li><li><code class="URI" xml:lang="en">mysql+zxjdbc:</code></li><li><code class="URI" xml:lang="en">mysql+mysqlconnector:</code></li><li><code class="URI" xml:lang="en">mysql+cymysql:</code></li><li><code class="URI" xml:lang="en">mysql+pymysql:</code></li><li><code class="URI" xml:lang="en">mysql+gaerdbms:</code></li><li><code class="URI" xml:lang="en">mysql+pyodbc:</code></li><li><code class="URI" xml:lang="en">mysql+mysqldb:</code></li><li><code class="URI" xml:lang="en">mysql2:</code></li><li><code class="URI" xml:lang="en">mysqli:</code></li><li><code class="URI" xml:lang="en">mysqlgis:</code></li><li><code class="URI" xml:lang="en">msql:</code></li><li><code class="URI" xml:lang="en">mssql:</code></li><li><code class="URI" xml:lang="en">ibase:</code></li><li><code class="URI" xml:lang="en">ifx:</code></li><li><code class="URI" xml:lang="en">oci8:</code></li><li><code class="URI" xml:lang="en">odbc:</code></li><li><code class="URI" xml:lang="en">odbc(access):</code></li><li><code class="URI" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">oracle:</anchor></code></li><li><code class="URI" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">redis:</anchor></code></li><li><code class="URI" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">rediss:</anchor></code></li><li><code class="URI" xml:lang="en">sqlite:</code></li><li><code class="URI" xml:lang="en">sqlite3:</code></li><li><code class="URI" xml:lang="en">pgsql:</code></li><li><code class="URI" xml:lang="en">postgres:</code></li><li><code class="URI" xml:lang="en">postgresql</code></li><li><code class="URI" xml:lang="en">sybase:</code></li></ul></figure></section><section><h1>標準化</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="6" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[6]</anchor-end> あらゆる点でほとんど<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">実装依存</anchor>であり、<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">標準化</anchor>の動きもありません。
みな似たような構文と意味に収まっていますが、細かい点に色々と違いがありそうです。</p></section><section><h1>環境変数 <code>DATABASE_URL</code></h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="14" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[14]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">Ruby on Rails</anchor> は<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">設定ファイル</anchor>内で接続先の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>を <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL</anchor>
で指定できるとしています。加えて、<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">環境変数</anchor> <dfn><code>DATABASE_URL</code></dfn>
によって指定する方法も提供しています。</p></section><section><h1>歴史</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="8" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[8]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">ODBC</anchor> や <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">Perlモジュール</anchor>の <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DBI</anchor> は、接続先の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>の種類 
(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">プロトコル</anchor>) によらず (ほぼ) 共通化された構文の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">接続文字列<title xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:10:">ODBC DSN</title></anchor>や 
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DSN<title xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:10:">DBI DSN</title></anchor> を採用していました。
これが単一の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">文字列</anchor>によって接続先<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>の記述を統合的に扱おうとした事例のはしりなのでしょうが、
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">接続文字列</anchor>は構文的に <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL</anchor> とまったく異なっていましたし、
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DSN<title xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:10:">DBI DSN</title></anchor> も <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL</anchor> とは見なされていませんでした。</p></section><section><h1>メモ</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="9" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[9]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>へ接続するためには<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">ホスト</anchor>、<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">プロトコル</anchor>、
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース名</anchor>など色々なオプションを指定しなければなりません。
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>を扱う<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">アプリケーション</anchor>の起動時や設定ファイルでこれを一々指定するのも中々大変ですし、
複数の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>に接続する巨大な<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">アプリケーション</anchor>では<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>管理だけで一苦労です。
その点、 <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">URL</anchor> のようにこうした指定を1つの<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">文字列</anchor>にまとめられると、
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>ごとに1<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">文字列</anchor>を指定できるようにすれば良いだけなので、
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">開発者</anchor>も<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">運用</anchor>担当者も楽になります。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="1" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[1]</anchor-end> <cite xml:lang="en">Engine Configuration — SQLAlchemy 0.9 Documentation</cite>
(<time>2015-07-06 00:17:46 +09:00</time> 版)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#database-urls">http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#database-urls</anchor-external></p><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="3" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[3]</anchor-end> <cite>Data Services — Stackato 3.0.1 documentation</cite>
(<time>2015-07-03 07:24:32 +09:00</time> 版)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://docs.stackato.com/3.0/user/services/data-services.html#database-url">http://docs.stackato.com/3.0/user/services/data-services.html#database-url</anchor-external></figcaption><blockquote><p>It contains the connection string for the bound database in the following format:</p><p>protocol://username:password@host:port/database_name</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="10" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[10]</anchor-end> <cite xml:lang="en">Welcome to Django-environ’s documentation! — Django-environ 0.4.0 documentation</cite>
(<time>2015-09-24 01:20:50 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://django-environ.readthedocs.io/en/latest/">https://django-environ.readthedocs.io/en/latest/</anchor-external></figcaption><blockquote><p>db_url</p><p>PostgreSQL: postgres://, pgsql://, psql:// or postgresql://</p><p>PostGIS: postgis://</p><p>MySQL: mysql:// or mysql2://</p><p>MySQL for GeoDjango: mysqlgis://</p><p>SQLITE: sqlite://</p><p>SQLITE with SPATIALITE for GeoDjango: spatialite://</p><p>LDAP: ldap://</p><p>cache_url</p><p>Database: dbcache://</p><p>Dummy: dummycache://</p><p>File: filecache://</p><p>Memory: locmemcache://</p><p>Memcached: memcache://</p><p>Python memory: pymemcache://</p><p>Redis: rediscache://</p><p>search_url</p><p>ElasticSearch: elasticsearch://</p><p>Solr: solr://</p><p>Whoosh: whoosh://</p><p>Xapian: xapian://</p><p>Simple cache: simple://</p><p>email_url</p><p>SMTP: smtp://</p><p>SMTP+SSL: smtp+ssl://</p><p>SMTP+TLS: smtp+tls://</p><p>Console mail: consolemail://</p><p>File mail: filemail://</p><p>LocMem mail: memorymail://</p><p>Dummy mail: dummymail://</p></blockquote></figure><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="11" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[11]</anchor-end> <cite xml:lang="en">seamusabshere/database_url: Convert back and forth between Heroku-style ENV<strong>[</strong>'DATABASE_URL<strong>']</strong> and Rails/ActiveRecord-style config/database.yml hashes.</cite>
(<time>2016-11-17 22:59:11 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/seamusabshere/database_url">https://github.com/seamusabshere/database_url</anchor-external></p><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="12" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[12]</anchor-end> <cite xml:lang="en">Riding Rails: Rails 4.1.0: Spring, Variants, Enums, Mailer previews, secrets.yml</cite>
(<time>2016-11-15 19:24:16 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://weblog.rubyonrails.org/2014/4/8/Rails-4-1/">http://weblog.rubyonrails.org/2014/4/8/Rails-4-1/</anchor-external></figcaption><blockquote><p>Second is that we’ve added support for database URLs in database.yml, and that we by default will be referring to ENV-backed URLs in the generated files.</p></blockquote></figure><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="13" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[13]</anchor-end> <cite xml:lang="en-us">John Griffin: Rails 4.1: Database URLs</cite>
(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">John Griffin</anchor>著, <time>2015-02-16 04:36:58 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://www.johng.co.uk/2014/04/29/rails-41-database-urls/">http://www.johng.co.uk/2014/04/29/rails-41-database-urls/</anchor-external></p><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="15" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[15]</anchor-end> <cite xml:lang="en">Environment Variables - GitLab Documentation</cite>
(<time>2016-11-17 23:03:20 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://docs.gitlab.com/ce/administration/environment_variables.html">https://docs.gitlab.com/ce/administration/environment_variables.html</anchor-external></figcaption><blockquote><p>DATABASE_URL	string	The database URL; is of the form: postgresql://localhost/blog_development</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="16" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[16]</anchor-end> <cite xml:lang="en">Environment Variables - GitLab Documentation</cite>
(<time>2016-11-17 23:03:20 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://docs.gitlab.com/ce/administration/environment_variables.html">https://docs.gitlab.com/ce/administration/environment_variables.html</anchor-external></figcaption><blockquote><p>The recommended way of specifying your database connection information is to set the DATABASE_URL environment variable. This variable only holds connection information (adapter, database, username, password, host and port), but not behavior information (encoding, pool). If you don't want to use DATABASE_URL and/or want to set database behavior information, you will have to either:</p><p>copy our template file: cp config/database.yml.env config/database.yml, or</p><p>set a value for some GITLAB_DATABASE_XXX variables</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="17" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[17]</anchor-end> <cite>Manual :: The Data Source Name</cite>
(<time>2016-11-17 23:50:11 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://pear.php.net/manual/en/package.database.db.intro-dsn.php">http://pear.php.net/manual/en/package.database.db.intro-dsn.php</anchor-external></figcaption><blockquote><p>To connect to a database through PEAR::DB, you have to create a valid DSN - data source name. This DSN consists in the following parts:</p><p>phptype: Database backend used in PHP (i.e. mysql , odbc etc.)</p><p>dbsyntax: Database used with regards to SQL syntax etc. When using ODBC as the phptype, set this to the DBMS type the ODBC driver is connecting to. Examples: access, db2, mssql, navision, solid, etc.</p><p>protocol: Communication protocol to use ( i.e. tcp, unix etc.)</p><p>hostspec: Host specification (hostname<strong>[</strong>:port<strong>]</strong>)</p><p>database: Database to use on the DBMS server</p><p>username: User name for login</p><p>password: Password for login</p><p>proto_opts: Maybe used with protocol</p><p>option: Additional connection options in URI query string format. options get separated by &amp;</p><p>The format of the supplied DSN is in its fullest form:</p><p>phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value</p><p>Most variations are allowed:</p><p>phptype://username:password@protocol+hostspec:110//usr/db_file.db</p><p>phptype://username:password@hostspec/database</p><p>phptype://username:password@hostspec</p><p>phptype://username@hostspec</p><p>phptype://hostspec/database</p><p>phptype://hostspec</p><p>phptype:///database</p><p>phptype:///database?option=value&amp;anotheroption=anothervalue</p><p>phptype(dbsyntax)</p><p>phptype</p><p>The currently supported database backends are:</p><p>dbase  -&gt; dBase</p><p>fbsql  -&gt; FrontBase (functional since DB 1.7.0)</p><p>ibase  -&gt; InterBase (functional since DB 1.7.0)</p><p>ifx    -&gt; Informix</p><p>msql   -&gt; Mini SQL (functional since DB 1.7.0)</p><p>mssql  -&gt; Microsoft SQL Server (NOT for Sybase. Compile PHP --with-mssql)</p><p>mysql  -&gt; MySQL (for MySQL &lt;= 4.0)</p><p>mysqli -&gt; MySQL (for MySQL &gt;= 4.1) (requires PHP 5) (since DB 1.6.3)</p><p>oci8   -&gt; Oracle 7/8/9</p><p>odbc   -&gt; ODBC (Open Database Connectivity)</p><p>pgsql  -&gt; PostgreSQL</p><p>sqlite -&gt; SQLite</p><p>sybase -&gt; Sybase</p><p>With an up-to-date version of DB, you can use a second DSN format</p><p>phptype(syntax)://user:pass@protocol(proto_opts)/database</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="18" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[18]</anchor-end> <cite xml:lang="en">go-sql-driver/mysql: Go MySQL Driver is a lightweight and fast MySQL driver for Go's (golang) database/sql package</cite>
(<time>2016-11-17 23:58:36 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/go-sql-driver/mysql">https://github.com/go-sql-driver/mysql</anchor-external></figcaption><blockquote><p>The Data Source Name has a common format, like e.g. PEAR DB uses it, but without type-prefix (optional parts marked by squared brackets):</p><p><strong>[</strong>username<strong>[</strong>:password<strong>]</strong>@<strong>]</strong><strong>[</strong>protocol<strong>[</strong>(address)<strong>]</strong><strong>]</strong>/dbname<strong>[</strong>?param1=value1&amp;...&amp;paramN=valueN<strong>]</strong></p><p>A DSN in its fullest form:</p><p>username:password@protocol(address)/dbname?param=value</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="19" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[19]</anchor-end> <cite>The DB-URI — TurboGears 1.0 documentation</cite>
(<time>2013-01-12 16:52:59 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://turbogears.org/1.0/docs/DbUri.html">http://turbogears.org/1.0/docs/DbUri.html</anchor-external></figcaption><blockquote><p>postgres://username@hostname/databasename</p><p>mysql://username:password@hostname:port/databasename</p><p>sqlite://path/to/file</p><p>postgres:///var/run/postgresql/test?debug=1</p><p>mysql://localhost/database?unix_socket=/var/lib/mysql/socket</p></blockquote></figure></section></body></html>