什么是使用PHP访问Access数据库文件的连接字符串 [英] What will be connection string to Access database file with PHP

查看:67
本文介绍了什么是使用PHP访问Access数据库文件的连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了WAMP,我在项目文件夹中具有访问数据库文件,但是在我的计算机上没有安装Access.

I installed WAMP, I have access database file in project folder, but don't have installed Access on my computer.

即使没有安装Access,我也可以使用PHP读取和更新Access文件吗?

Can I read and update Access file with PHP even I don't have installed Access?

Access数据库文件的连接字符串是什么?

And what will be connection string to Access database file?

我真的需要帮助.

推荐答案

所有您需要的是

All you need is the PHP api for ODBC. Here is the example from the docs itself:

<?php
// Microsoft SQL Server using the SQL Native Client 10.0 ODBC Driver - allows connection to SQL 7, 2000, 2005 and 2008
$connection = odbc_connect("Driver={SQL Server Native Client 10.0};Server=$server;Database=$database;", $user, $password);

// Microsoft Access
$connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$mdbFilename", $user, $password);

// Microsoft Excel
$excelFile = realpath('C:/ExcelData.xls');
$excelDir = dirname($excelFile);
$connection = odbc_connect("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=$excelFile;DefaultDir=$excelDir" , '', '');
?>

这篇关于什么是使用PHP访问Access数据库文件的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆