Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to connect PHP to SQL Server Compact Edition?

Is it possible to connect PHP to a SQL Server Compact Edition database? What would be the best driver?


I need it for a desktop application where SQL Server Express is too heavy.

like image 759
Vincent Avatar asked Oct 03 '08 18:10

Vincent


2 Answers

Short Answer : No.

Long Answer : To my knowledge, unlike PostgreSQL / MySQL / MS-SQL, there is no native driver to connect PHP to SQL Server Compact Edition.

If you want to connect to it, your best bet is to use PHP ODBC connections to talk to a ODBC Driver connected to the SQL Compact server. But its pretty much a hack, and you'd be crazy to use this kind of thing for anything remotely important.

If you are worried about SQL Server Express being too heavy, use MySQL with MyISAM tables. It's pretty fast and lightweight. Emergent has a good checklist of things to configure / disable to make MySQL even faster and use less resources.


Relevant links :

MSDN Post asking the same question

Erik EJ's blog - SQL Compact with OLE DB

like image 95
maxsilver Avatar answered Oct 11 '22 15:10

maxsilver


You could also consider SQLite:

http://www.devshed.com/c/a/PHP/Introduction-to-Using-SQLite-with-PHP-5/

like image 23
AlexCuse Avatar answered Oct 11 '22 15:10

AlexCuse