Data source name: Difference between revisions

Content deleted Content added
Line 37:
</syntaxhighlight>
 
In [[PHP]] using the [https://pear.php.net/package/DB/ PEAR::DB] package to open a connection without an external DSN (a "DSN-less connection", i.e., using a Connection String){{Clarify|How is this an example of DSN use|date=June 2013}}, the code might resemble the following:
 
<syntaxhighlight lang="php">
Line 44:
$dsn = "mysql://john:pass@localhost:3306/my_db";
$db = DB::connect($dsn);
</syntaxhighlight>{{Clarify|How is this an example of DSN use|date=June 2013}}
 
PHP with PDO.<ref>{{cite web |title=PHP: PDO - Manual |url=https://www.php.net/pdo |website=www.php.net |access-date=22 January 2025 |language=en}}</ref>:
<syntaxhighlight lang="php">
$dsn = "mysql:host=localhost;dbname=example";