RE: Jet database access problem from web service

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Sonya (Sonya_at_discussions.microsoft.com)
Date: 10/13/04


Date: Wed, 13 Oct 2004 11:13:05 -0700

Hey folks,

Dunno if anyone cares, but I found the problem. In the Webmethod attribute,
there is a named parameter TransactionOption=TransactionOption.RequiresNew.
Well, seeing as Access doesn't suport transactions, it was killing even the
connection. Having removed that, everything works.

Sonya

"Sonya" wrote:

> Hello,
>
> I have trouble connecting to Access database from my web service. Database
> is located in a subdirectory of where service pages are. Code below produces
> the following exception: "No error information available - E_NOINTERFACE".
>
> [WebMethod(Description = "This method tests connection",
> EnableSession = true,
> TransactionOption=TransactionOption.RequiresNew)]
> public bool TestConnection()
> {
> // Get connection string from web.config
> string strConnection =
> ConfigurationSettings.AppSettings.Get("ConnectionString");
> // Here's actual connection string
> // "Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=c:\WebServiceLocation\Data\Data.mdb;Jet OLEDB:Database
> Password=testpassword"
> string username =
> System.Security.Principal.WindowsIdentity.GetCurrent().Name;
>
> if (strConnection == null)
> return false;
>
> OleDbConnection conn = new OleDbConnection(strConnection);
> try
> {
> conn.Open();
> return true;
> }
> catch(Exception exc)
> {
> return false;
> }
> finally
> {
> conn.Close();
> }
> }
>
> I tried a number of permission changes. I granted ASPNET account full
> permissions into the directory where database is located; I granted
> IUSR_MachineName account the same set of permissions; I tried impersonating a
> normal user who has full permissions over Data directory; tried having Asp
> process run under System account by modifying Machine.config. None of these
> work and I always get the E_NOINTERFACE. (I did check this code out of
> regular WinForms app and it works just fine).
>
> I also tried an Odbc connection with with the follwoing string:
> @"Driver={Microsoft Access Driver
> (*.mdb)};Dbq=c:\WebServiceLocation\Data\Data.mdb;Uid=Admin;Pwd=testpassword"
> That gets me the following error:
> "ERROR [25000] [Microsoft][ODBC Driver Manager] Failed to enlist on calling
> object's transaction\r\nERROR [IM006] [Microsoft][ODBC Driver Manager]
> Driver's SQLSetConnectAttr failed"
>
> I am at a loss as to what to do. Any suggestions will be greatly appreciated.
>
> Sonya



Relevant Pages

  • Re: ActiveConnection works at one host but not at another
    ... I'd set the permissions for the .mdb file, ... I used a connection string because I'd read some forum ... Access 2002 database. ... I notice that instead of an explicit connection object, ...
    (microsoft.public.inetserver.asp.db)
  • Re: (Newbie)Application Roles
    ... level: the database itself. ... SQL Server accommodates these needs through the use of application ... the user's connection through a specific application. ... the connection permanently loses all permissions applied to ...
    (microsoft.public.sqlserver.security)
  • Re: Connection problem with Access
    ... If you don't need the Word object to connect, remove the relevant code as it's probably a distraction. ... However, I'm not sure you can manually connect Word to an Access data source that has a securit database, unless the Admin username and a blank password will give you access to the table you need. ... I think you'd probably have to do it the way I suggested, at lleast for an OLE DB connection. ... permissions can be relatively fine-grained, ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Dont understand my permissions to my SQL Server DB
    ... Have you checked the Logon account permissions for each user? ... Open that procedure in the .adp. ... UID in the connection string have the same name as the name returned by ... > I have an offsite SQL Server database. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: VC++ ADO VFPOLEDB: DB locally works; DB on NT server does not
    ... The VFP database itself doesn't have a password on it, ... application that normally accesses the database does require a user password. ... you raise the question of ADO permissions or user. ... and its Data Connection Wizard to create the connection to my database on ...
    (microsoft.public.fox.programmer.exchange)