Can I use PHP with Oledb connection?
As far as I know database connection as provided by PHP extension are all odbc.
You can also use OLEDB directly to connect to Sql Server but the API is messier as compared to a adodb connection which is optimized to work with Sql Server and MS Access. ADO.Net is a . Net based db connection "architecture". In ADO.Net there's a library for Oledb - System.
Object Linking and Embedding Database (OLE DB) is a connectivity method similar to Open Database Connectivity (ODBC) and uses the same core application programming interface (API) to help bridge communication between client applications and a variety of data sources.
OLE DB stands for Object Linking and Embedding, Database. It is an API designed by Microsoft, that allows users to access a variety of data sources in a uniform manner.
You can use ActiveX Data Objects (Microsoft's OLEDB ActiveX layer) in PHP-Win without any third party extension as such:
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
// Microsoft Access connection string.
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\inetpub\wwwroot\php\mydb.mdb");
// SQL statement to build recordset.
$rs = $conn->Execute("SELECT myfield FROM mytable");
echo "<p>Below is a list of values in the MYDB.MDB database, MYABLE table, MYFIELD field.</p>";
// Display all the values in the records set
while (!$rs->EOF) {
$fv = $rs->Fields("myfield");
echo "Value: ".$fv->value."<br>\n";
$rs->MoveNext();
}
$rs->Close();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With