dongping5230 2018-12-13 11:13
浏览 43

如何写入动态创建的mdb文件?

I have a web application written in PHP 5.6 and based on CodeIgniter 3 that creates a mdb file for every user that requests it. When a requests is made, a copy of a template mdb file is made into a folder created at runtime.

Here is my problem:

I have to write some data in such file, but I can't open a connection with it. I've tried the following:

odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$file", '', '');

and:

$odbc_con = new COM("ADODB.Connection");
$constr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$file;";
$odbc_con->open($constr);

and also:

new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$file; Uid=; Pwd=;");

and other similar way found online, but no matter what I try, I always get the error:

[Microsoft][Driver Manager ODBC] Data source name not found and default driver not specified.

I also tried to create a system DSN for mdb files with no database selected, since it is created dynamically, but I keep getting this error.

Am I missing something?

PS: this mdb file is needed for an existing application and I cannot use another format, like for example SQLite without modify that application.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥35 平滑拟合曲线该如何生成
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站