I am trying to connect to the Ms access database using PHP. The database, that I created has '.accdb' as an extension. I tried the following steps. but I get this error "The specified DSN contains an architecture mismatch between the Driver and Application". Any ideas??

  1. Go to your control panel and Open the Administrative Tools icon in your Control Panel.
  2. Double-click on the Data Sources (ODBC) icon inside.
  3. Choose the System DSN tab.
  4. Click on Add in the System DSN tab.
  5. Select the Microsoft Access Driver. Click Finish.
  6. In the next screen, click Select to locate the database.
  7. Give the database a Data Source Name (DSN).
  8. Click OK.

For connection:

$conn=odbc_connect('data_source','','');
Member Avatar for diafol

Have you tried connecting via PDO?

In your php.ini file, ensure that the line

extension=php_pdo_odbc.dll 

is uncommented

DO you really need to use an access DB? It's pretty grotty. Unless your Access DB is very well designed and doesn't do very much other than be read from, then you may be OK, but otherwise, it has a tendency to get corrupted. You'll probably be looking at 15-ish concurrent users before it starts throwing a wobbly. Move to a better one if you can. MySQL or PostgreSQL play very nicely. If you're tied into MS, try SQL Server. I think there's a migration tool for Access to SQL Server.

@diafol Thanks for the reply. Yeah I think I will go with SQl server. But which(SQl server) one do I need to download?

Cheers

Member Avatar for diafol

But which(SQl server) one do I need to download?

Will you be using this on a remote system eventually?
Will you be using PHP on a Windows server (remote)?
Are you prepared to PAY? Unless you go Express.

This may determine which RMDBS to go for. But I know v. little about MSSQL.

@diafol Thanks again!!
I am not sure going remote. All I want is to use mssql with php on the windows server.
I can do PHP with MYSQL. Just want to know(learn) how to do this with MSSQL.

Cheers!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.