469,282 Members | 1,692 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

Jet database access problem from web service

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("ConnectionS tring");
// 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.GetCurre nt().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;U id=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
Nov 18 '05 #1
1 2141
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("ConnectionS tring");
// 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.GetCurre nt().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;U id=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

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Robert McGregor | last post: by
4 posts views Thread by Bob Sanderson | last post: by
1 post views Thread by =?Utf-8?B?TmVsc29uIEFuZHLDqQ==?= | last post: by
5 posts views Thread by Gav | last post: by
6 posts views Thread by =?Utf-8?B?UGFycm90?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.