By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,915 Members | 1,327 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,915 IT Pros & Developers. It's quick & easy.

Using OleDb w/MSJet to Access DB causing exception in webmethod

P: n/a
I'm receiving an exception when my webmethod exits after opening/closing an
Access database.

I can reproduce this easily enough by creating a new default ASP .NET Web
Service in VS.NET 2003. Adding this code to the default HelloWorld()
webmethod will cause the problem.

String* sConnection = S"Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data
Source=c:\\mydb.mdb";

OleDbConnection* poDbConnection = new OleDbConnection();
poDbConnection->set_ConnectionString( sConnection );
poDbConnection->Open();
poDbConnection->Close();
poDbConnection->Dispose();

When HelloWorld exits, you'll get the following exception in the trace window:

An unhandled exception of type 'System.Threading.ThreadAbortException'
occurred in Unknown Module.
Additional information: Thread was being aborted.

I'm using Windows XP SP2, VS.NET 2003 and framework 1.1 SP1

While this doesn't cause the app to crash outright, it is delaying all
subsequent calls that are made on that webmethod. I'm seeing delays of
several minutes in some cases!

I'm at my wits end with this and have exhausted all my options. Am I
missing something obvious? Is there a way to get this to shutdown gracefully?

-jb
Nov 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

Try not to call an object's Dispose method like this. What happens if you
just call open and close, but leave off the Dispose method? Another
thought is to make sure that the Jet driver is thread safe. If it is not
thread safe (e.g. was intended for single user applications) then you can
expect all kinds of issues.

I hope this helps,

Dan Rogers
Microsoft Corporation

--------------------
Thread-Topic: Using OleDb w/MSJet to Access DB causing exception in
webmethod
thread-index: AcTkgfD0Qm6Y2nmHTtm33f4s2h2atg==
X-WBNR-Posting-Host: 207.236.239.4
From: =?Utf-8?B?c3BpY3l6?= <sp****@discussions.microsoft.com>
Subject: Using OleDb w/MSJet to Access DB causing exception in webmethod
Date: Fri, 17 Dec 2004 13:47:01 -0800
Lines: 32
Message-ID: <07**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:8192
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

I'm receiving an exception when my webmethod exits after opening/closing an
Access database.

I can reproduce this easily enough by creating a new default ASP .NET Web
Service in VS.NET 2003. Adding this code to the default HelloWorld()
webmethod will cause the problem.

String* sConnection = S"Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data
Source=c:\\mydb.mdb";

OleDbConnection* poDbConnection = new OleDbConnection();
poDbConnection->set_ConnectionString( sConnection );
poDbConnection->Open();
poDbConnection->Close();
poDbConnection->Dispose();

When HelloWorld exits, you'll get the following exception in the trace
window:

An unhandled exception of type 'System.Threading.ThreadAbortException'
occurred in Unknown Module.
Additional information: Thread was being aborted.

I'm using Windows XP SP2, VS.NET 2003 and framework 1.1 SP1

While this doesn't cause the app to crash outright, it is delaying all
subsequent calls that are made on that webmethod. I'm seeing delays of
several minutes in some cases!

I'm at my wits end with this and have exhausted all my options. Am I
missing something obvious? Is there a way to get this to shutdown
gracefully?

-jb

Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.