Reputation: 11
I have a very simple SQLite database that I need to read/write to from a different server.
Say the database is stored here : http://www.abc.com/data/data.sqlite And I'm using PHP to access it from http://www.xyz.com
So my first attempt was the following:
$dbpath = "http://www.abc.com/data/data.sqlite";
$dbconn = "sqlite:$dbpath";
$db = new PDO($dbconn)
No good, I get the following:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [14] unable to open database file'.........PDO->__construct('sqlite:http://w...') #1 {main} thrown
If try and copy the database onto the same server I'm accessing from:
$dbpath = "http://www.xyz.com/data/data.sqlite";
$dbconn = "sqlite:$dbpath";
$db = new PDO($dbconn)
I get the same message. It's only when I give it a relative path on the same server:
$dbpath = "../data/data.sqlite";
That it actually works. I know the database URLs and database itself are correct. So is there a limitation to accessing cross-servers? Anyone know out to solve this issue?
Thanks a lot.
Upvotes: 1
Views: 2107
Reputation: 157828
There are no such thing like 'SQLite server'. It exists only in a form of a file.
But there are no files in the HTTP protocol, but URIs only.
So, this is essential incompatibility.
To be able to do remote calls you have 3 choices
Upvotes: 2