Can I connect PHP to SQL Server Compact Edition?

Can I connect PHP to a SQL Server Compact Edition database? What will be the best driver?


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

+4
source share
5 answers

Short answer: No

Long answer: As far as I know, unlike PostgreSQL / MySQL / MS-SQL, there is no native driver for connecting PHP to SQL Server Compact Edition.

If you want to connect to it, it is best to use PHP ODBC connections to talk to the ODBC driver connected to the SQL Compact server. But this is pretty much a hack, and you would be crazy to use such things for anything remotely important.

If you are worried about using too much SQL Server Express, use MySQL with MyISAM tables. It is pretty quick and easy. Emergent has a good checklist of things to configure / disable to make MySQL even faster and use less resources.


Relevant links:

MSDN message asking the same question

Erik EJ Blog - SQL Compact with OLE DB

+4
source

I used php-odbtp for the PHP interface (with ADOdb ) to the MS SQL server, and it works well, even on remote networks.

It provides a tunneling protocol from a non-odbc (Linux) platform to a service installed on a Win32 machine to buffer requests to and from an ODBC connection. A bit of pain to set up the first time, at least 2-3 years ago when I first used it. Should also work just fine for Win32 ↔ Win32 applications.

Not familiar with SQL CE, but I would suggest that it supports some kind of ODBC connection and standard T-SQL commands.

+2
source

I wrote a php class that processes compact SQL files using a PHP COM object.

This means that it will only work on computers running Windows that have the SQL Compact Edition runtime installed.

You can download here (the article is in German, link below) with an example database file and script

http://www.klemmkeil.de/sql-compact-edition-sdf-mit-php-auslesen/

+2
source

Question: why? Why not just use the express version?

I have to say that I am interested, but I cannot say that I used the CE database for anything outside the .Net application, in which there were assemblies in the application folder.

-1
source

Source: https://habr.com/ru/post/1277451/


All Articles