本文介绍了Codeigniter使用ms访问数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我使用访问数据库(* mdb)。
我的代码和成功连接:
So I using access database(*mdb).This my code and success to connect:
$db['test']['hostname'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\blabla.mdb';
$db['test']['username'] = '';
$db['test']['password'] = '';
$db['test']['database'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\blabla.mdb';
$db['test']['dbdriver'] = 'odbc';
$db['test']['dbprefix'] = '';
$db['test']['pconnect'] = TRUE;
$db['test']['db_debug'] = TRUE;
$db['test']['cache_on'] = FALSE;
$db['test']['cachedir'] = '';
$db['test']['char_set'] = 'utf8';
$db['test']['dbcollat'] = 'utf8_general_ci';
$db['test']['swap_pre'] = '';
$db['test']['autoinit'] = TRUE;
$db['test']['stricton'] = FALSE;
现在我想从其他计算机使用accessdb。
这个accessdb(* mdb)已经被共享,并且我创建了地图网络驱动器(Z:)。
And now I want to using accessdb from other computer.This accessdb(*mdb) has been shared and I make map network drive(Z:).
所以我更改了主机名和数据库,
So I was change hostname and database but its failed:
$db['test']['hostname'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=Z:\blabla.mdb';
$db['test']['database'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=Z:\blabla.mdb';
我尝试这样做:
$db['test']['hostname'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=\\10.0.0.107\share\blabla.mdb';
$db['test']['database'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=\\10.0.0.107\share\blabla.mdb';
但仍然报错:
Unable to connect to your database server using the provided settings.
Filename: D:\folder\folder\system\database\DB_driver.php
Line Number: 124
甚至我尝试用php
连接,这是结果。
我强烈建议使用SQL Server(Express Edition,如果没有其他)比访问文件 - 你会得到一个更好的经验+你将能够如果需要,可以随着网站扩展而更容易迁移。
I would highly recommend using SQL Server (Express Edition if nothing else) than an access file - you will get a much improved experience + you will be able to migrate easier as the site expands if needed.
这篇关于Codeigniter使用ms访问数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!