Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
318 views
in Technique[技术] by (71.8m points)

php - Codeigniter using ms access database

So I using access database(*mdb). This my code and success to connect:

$db['test']['hostname'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=C:labla.mdb';
$db['test']['username'] = '';
$db['test']['password'] = '';
$db['test']['database'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=C:labla.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;

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:labla.mdb';
$db['test']['database'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=Z:labla.mdb';

And I try this to:

$db['test']['hostname'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=\10.0.0.107sharelabla.mdb';
$db['test']['database'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=\10.0.0.107sharelabla.mdb';

But it still error:

Unable to connect to your database server using the provided settings.
Filename: D:folderfoldersystemdatabaseDB_driver.php

Line Number: 124

and even i try to connect with php and this is the result php using msaccess

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem is that the default IIS IUSER cannot access files over a network share. the workaround is detailed here: http://support.microsoft.com/kb/207671.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...