Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:\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;

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';

And I try this to:

$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';

But it still error:

Unable to connect to your database server using the provided settings.
Filename: D:\folder\folder\system\database\DB_driver.php

Line Number: 124

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

like image 811
Belajar Avatar asked Jan 11 '13 08:01

Belajar


People also ask

How do you load a database in CI?

In CodeIgniter, go to application/config/databse. php for database configuration file. In database. php file, fill the entries to connect CodeIgniter folder to your database.

Can we use multiple database in CodeIgniter?

If your application is built with the CodeIgniter framework, it's exceptionally simple to use multiple databases. CodeIgniter provides an easy way to put through and utilize numerous databases on the same or distinct server.


1 Answers

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.

like image 100
Eldarni Avatar answered Sep 30 '22 07:09

Eldarni