Reputation: 756
Our Intranet runs under asp/vb script / MS Access.
We have been experiencing issues with MSAccess and would like to replace it with MSSQL Server. Initially I thought I could just import the current data from Access into MSSQL and connect to them via linked tables. - so no need to touch the code.
However when I try to open a page that uses a linked table I get the following error:
Microsoft JET Database Engine error '80004005' ODBC--connection to 'xxxx' failed. /index.asp, line 80
xxxx is the User DSN I defined to link the tables. - This now uses SQL Server auth. but I had the same error when using window auth.
When opening the linked tables from within access everything is fine.
IIS 7.5 / ASP classic (vbscript) SQL Server 2008 R2
Does anyone have any ideas, I really want to avoid recoding anything and changing to use SQL server directly would involve a lot of that!
Upvotes: 1
Views: 1639
Reputation: 123829
The first thing we need to do is determine whether it is possible to "see" a SQL Server linked table in a Jet/ACE database from outside of the Access application itself. My test database Database1.accdb
contains a linked table
The following VBScript proves that I can "see" that table without being in Access itself:
Option Explicit
Dim con '' As ADODB.Connection
Dim rst '' As ADODB.Recordset
Const AccessLinkedTableName = "dbo_linkedTable"
Set con = CreateObject("ADODB.Connection")
con.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data source=C:\Users\Public\Database1.accdb;"
Set rst = CreateObject("ADODB.Recordset")
rst.Open "SELECT COUNT(*) AS n FROM [" & AccessLinkedTableName & "]", con
WScript.Echo "[" & AccessLinkedTableName & "] contains " & rst(0).Value & " row(s)"
rst.Close
Set rst = Nothing
con.Close
Set con = Nothing
When I run that script from my normal account I get the following
C:\Users\Public>cscript /nologo linkedTableTest.vbs
[dbo_linkedTable] contains 2 row(s)
So we know that it can work.
Your question raises two concerns, both related to the fact that ASP scripts normally run under their own IUSR_MachineName
account.
You said that you used a "User DSN", but if you created that User DSN then nobody else can see it. You probably want to be using a System DSN instead.
If you are using Windows Authentication on the SQL server then you may have to grant access to the SQL Server database for the IUSR_MachineName
account. (The alternative would be to use SQL Authentication and save the SQL credentials in the Linked Table definition, but saved passwords are not a very good idea.)
Upvotes: 1