473,399 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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 2333
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John Morgan | last post by:
I have Enterprise Manager on my local machine. For the last twelve months it has been connecting without problem to my online SQL Server database provided by my ISP. Three weeks ago the ISP...
2
by: Robert McGregor | last post by:
Hi all, I've got a Front End / Back End database that was working just fine. One day i opened the FE to find that if I tried to open one of the linked tables from the database window, nothing...
2
by: jfathman | last post by:
Hello, We are considering a project that requires implementing a database (Windows PC based) that would be shared by a small number of users. The database would store events output by our...
6
by: Jeff | last post by:
Has anyone had any luck accessing an Oracle database from a web service? I have a C# DLL with various code to query an Oracle database. If I call the methods in this DLL from a Windows Forms...
4
by: Bob Sanderson | last post by:
I am trying to set up an ODBC DSN to our company MySQL database so that I can use a MS Access front end. I am using the MySQL ODBC 3.51 driver. The database is running off of Apache on our Windows...
1
by: =?Utf-8?B?TmVsc29uIEFuZHLDqQ==?= | last post by:
Dear friends, I'm a Web Services newbie and I have created a simple Web Service that given 3 parameters accesses a database and returns 1 value. When run from Visual Studio 2005, the Webservice...
5
by: war_wheelan | last post by:
I created the db with the attached script and I am able to access it until I reboot the server. I've tried enabling flag 1807 via the SQL server service and the startup parameters of the instance....
5
by: Gav | last post by:
I'm writing a windows application (using C# VS 2005 Pro) to access a MS SQL database and although it is working fine (up to now) I'm not sure I'm going about it in the best way. Can anybody point...
6
by: =?Utf-8?B?UGFycm90?= | last post by:
I cannot access my SQL database in a browser control created in my C# Windows application program I can, however, access the database from an IE browser. I get the ubiquitous "Login failed for NT...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.