-1

I realise this question is asked several times previously but having looked at the guidance on the previous questions I still have no solution

A working classic ASP application was transferred to another server and is indeed in the IIS Manager (version 8.5.9600). The index.asp page works okay but when we select one of the two options they both provide a "500 - Internal server error". The sub pages are in the same folder. I set up the browser to give me more details which states the following

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

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

The two options on the main page interrogate Access databases and I have ensured Access is installed on the server and the Access files in the correct location

I found this may be related to System DSN to provide an ODBC to the Access database and in the asp file I found the following

<%
accessdb="files\retirals"
DSN = "DRIVER={Microsoft Access Driver (*.mdb)};"
DSN = DSN & "DBQ=" & Server.Mappath(accessdb)
Set DBConnection = Server.CreateObject("adodb.connection")
Set rs=Server.CreateObject("ADODB.RecordSet")
DBConnection.Open DSN

However, I am assured that NO System DSN was setup on the previous server (I am not able to access the previous server). What is slightly confusing is that the subcomponents uses different Access databases but each states the same DSN value of

DBConnection.Open DSN

I tried setting up one System DSN named "DSN" using the "Mcirosft Access Driver" but it still states "Data source name not found and no default driver specified". I also restarted the website in IIS afterwards. But this still does not help. How do I resolve this please?

ComputerVersteher
  • 2,638
  • 1
  • 10
  • 20
AJF
  • 1,801
  • 4
  • 27
  • 54

1 Answers1

2

The most likely reason you're getting this particular error message is the drivers for JET databases (Access files with the mdb extension) are 32 bit only, and you need to enable 32 bit applications in your app pool.

I recommend using the OLEDB driver rather than the ODBC one, the connection string would look like this

DBConnection.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.Mappath(accessdb)

I notice that you don't specify the actual name of your database file in accessdb, just the path. You need the filename. Also bear in mind that .mdb is the old format for databases created in Access. Recent versions of Access will save files in the newer .accdb format unless you specify that you want an mdb when you save. For accdb files you need a different driver which isn't installed on Windows by default, you need to install it yourself.

You should find other questions on Stack Overflow which cover all of these issues in more detail.

John
  • 4,658
  • 2
  • 14
  • 23
  • thanks for this. I enabled the 32 bit applications in the websites application pool and the sub components open when selected from the home screen. However, updates on the records fail with the message [ODBC Microsoft Access Driver] Cannot update. Database or object is read-only – AJF Jul 18 '18 at 14:08
  • 1
    And that is another question. You're trying to open an editable recordset. You definitely should use the OLEDB connection string I suggested and open your recordset with `rs.Open "Your SQL query here",DBConnection,3,1`. To understand what the 3 and 1 are for you need to do some reading up on cursors and lock types. Personally I find it far more satisfactory to use INSERT, UPDATE and DELETE queries than create editable recordsets – John Jul 19 '18 at 09:40