Doc #77886 [Nab]: using host in dsn string
| From: | ch dot derenne at gmail dot com | Date: | Sun, 14 Apr 2019 16:04:55 +0000 |
| Subject: | Doc #77886 [Nab]: using host in dsn string | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16570@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77886&edit=1
ID: 77886
User updated by: ch dot derenne at gmail dot com
Reported by: ch dot derenne at gmail dot com
Summary: using host in dsn string
Status: Not a bug
Type: Documentation Problem
Package: PDO Firebird
Operating System: fedora28
PHP Version: 7.3.4
Block user comment: N
Private report: N
New Comment:
Why using two different syntax if the advantage of using pdo is to use one syntax whatever the SGBD
is ?
Or why not giving warning when we use host string in the dsn for firebird ?
Previous Comments:
------------------------------------------------------------------------
[2019-04-13 16:45:39] salathe@php.net
Details on the DSN for the Firebird PDO driver is available at https://www.php.net/manual/en/ref.pdo-firebird.connection.php
------------------------------------------------------------------------
[2019-04-13 16:19:42] ch dot derenne at gmail dot com
Description:
------------
---
From manual page: https://php.net/index
---
In all documentation of PDO we see that host is the database host and path is the local database
path relative to the host
But using this with firebird issues that database file is not found (of course, if host is not
localhost)
In fact, searching in firebirdsql.org website, we see that we don't care about host, we have to
use a database patch like hostname:databasepath
So why not using same syntaxe whatever firebird, mysql or other database ?
Or best : detecting if we ar eusing the host variable or not ?
We've spent one hour to find what was wrong
Test script:
---------------
$host="10.1.15.2"
$databasepath="/var/lib/firebird/data/db.fdb";
$usn="SYSDBA";
$psw="masterke";
$str_conn="firebird:host=".$host.";dbname=".$host.":".$databasepath.";charset=ISO8859_1;role=".$role;
try
{
$db = new PDO($str_conn, $usn, $psw);
}
catch(PDOException $e)
{
die ('ERREUR PDO dans ' . $e->getFile() . ' L.' . $e->getLine() . '
: ' . $e->getMessage());
}
echo "connexion ok"
Expected result:
----------------
connexion ok
Actual result:
--------------
PDO Error (file not found)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77886&edit=1