Connecting Tech Pros Worldwide Forums | Help | Site Map

Could not use ''; file already in use

Miro
Guest
 
Posts: n/a
#1: Nov 19 '05
I've read a couple of threads on this error but none of them could help me so
I'm posting myself.

When I try open and read (not update) an ACCESS database on a network share
I occasionally get:

"Could not use ''; file already in use." error.

This always happens when the database is open but sometimes even when it's
not. Not manually anyway. I consequently use DataAdapter.Fill() method which
should close the connection, right? Anyway, It must work even when the
database is open (not design mode). It does so when I run the application
against a database on the webbserver. What's the difference when its on a
network share? The IUSR has full rights on the database-folder. And as I said
earlier it works, but not always so it's unlikely a basic security problem.
There must be some way to force ASP.NET to read an open database. Can anybody
please help me?

/Miro

Robbe Morris [C# MVP]
Guest
 
Posts: n/a
#2: Nov 19 '05

re: Could not use ''; file already in use


Access is not a good fit for web applications. I've seen your
error occur often times when you don't properly close
the connection "in every instance" and the lock file
gets left.

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net





"Miro" <Miro@discussions.microsoft.com> wrote in message
news:18C98472-C6B4-4BC8-8217-0DD5937527AC@microsoft.com...[color=blue]
> I've read a couple of threads on this error but none of them could help me
> so
> I'm posting myself.
>
> When I try open and read (not update) an ACCESS database on a network
> share
> I occasionally get:
>
> "Could not use ''; file already in use." error.
>
> This always happens when the database is open but sometimes even when it's
> not. Not manually anyway. I consequently use DataAdapter.Fill() method
> which
> should close the connection, right? Anyway, It must work even when the
> database is open (not design mode). It does so when I run the application
> against a database on the webbserver. What's the difference when its on a
> network share? The IUSR has full rights on the database-folder. And as I
> said
> earlier it works, but not always so it's unlikely a basic security
> problem.
> There must be some way to force ASP.NET to read an open database. Can
> anybody
> please help me?
>
> /Miro[/color]


Norman Yuan
Guest
 
Posts: n/a
#3: Nov 19 '05

re: Could not use ''; file already in use


Even you said it worked earlier, still the most possible reason could the
user account running the ASP.NET appdoes not have read/write permission to
the *.mdb file. Before you can tell whether the folder where *.mdb is
licated is allowed full access to some users, you have to make sure who is
exactly access it. Are you sure the ASP.NET app or apps run with
IUSR_MachineName account? (By default. ASP.NET runs on ASPNET/Network
Service account, unless you set "impersonate=true" for the ASP.NET app or
apps.

"Miro" <Miro@discussions.microsoft.com> wrote in message
news:18C98472-C6B4-4BC8-8217-0DD5937527AC@microsoft.com...[color=blue]
> I've read a couple of threads on this error but none of them could help me
> so
> I'm posting myself.
>
> When I try open and read (not update) an ACCESS database on a network
> share
> I occasionally get:
>
> "Could not use ''; file already in use." error.
>
> This always happens when the database is open but sometimes even when it's
> not. Not manually anyway. I consequently use DataAdapter.Fill() method
> which
> should close the connection, right? Anyway, It must work even when the
> database is open (not design mode). It does so when I run the application
> against a database on the webbserver. What's the difference when its on a
> network share? The IUSR has full rights on the database-folder. And as I
> said
> earlier it works, but not always so it's unlikely a basic security
> problem.
> There must be some way to force ASP.NET to read an open database. Can
> anybody
> please help me?
>
> /Miro[/color]


Miro
Guest
 
Posts: n/a
#4: Nov 19 '05

re: Could not use ''; file already in use


Thanks!

Yes, I'm using impersonate=true to be absolutely sure that the user has full
rights on the folder. The database is on a Novell File Server and I had big
troubles get it working in the first place. Finally I got some expert-help
from Microsoft which solved it, for a while. Actually, it's not IUSR but som
new account created in both IIS and Novell. But I'm sure the account has full
rights.

/Miro


"Norman Yuan" wrote:
[color=blue]
> Even you said it worked earlier, still the most possible reason could the
> user account running the ASP.NET appdoes not have read/write permission to
> the *.mdb file. Before you can tell whether the folder where *.mdb is
> licated is allowed full access to some users, you have to make sure who is
> exactly access it. Are you sure the ASP.NET app or apps run with
> IUSR_MachineName account? (By default. ASP.NET runs on ASPNET/Network
> Service account, unless you set "impersonate=true" for the ASP.NET app or
> apps.
>
> "Miro" <Miro@discussions.microsoft.com> wrote in message
> news:18C98472-C6B4-4BC8-8217-0DD5937527AC@microsoft.com...[color=green]
> > I've read a couple of threads on this error but none of them could help me
> > so
> > I'm posting myself.
> >
> > When I try open and read (not update) an ACCESS database on a network
> > share
> > I occasionally get:
> >
> > "Could not use ''; file already in use." error.
> >
> > This always happens when the database is open but sometimes even when it's
> > not. Not manually anyway. I consequently use DataAdapter.Fill() method
> > which
> > should close the connection, right? Anyway, It must work even when the
> > database is open (not design mode). It does so when I run the application
> > against a database on the webbserver. What's the difference when its on a
> > network share? The IUSR has full rights on the database-folder. And as I
> > said
> > earlier it works, but not always so it's unlikely a basic security
> > problem.
> > There must be some way to force ASP.NET to read an open database. Can
> > anybody
> > please help me?
> >
> > /Miro[/color]
>
>
>[/color]
Miro
Guest
 
Posts: n/a
#5: Nov 19 '05

re: Could not use ''; file already in use


Thanks!

What must I do to be absolutely sure that the connection is closed. This is
the function I'm using:

public DataSet GetFromAccessDatabase(String SQLQuery)
{
OleDbConnection conn = new OleDbConnection(this._ConnectionString);
OleDbCommand select = new OleDbCommand(SQLQuery);
OleDbDataAdapter dataAD = new OleDbDataAdapter();
dataAD.SelectCommand = select;
select.Connection = conn;
DataSet mds = new DataSet();
dataAD.Fill(mds);
select.Connection.Close();
dataAD.Dispose();
conn.Dispose();
select.Dispose();
return mds;
}

Is it a good solution to try deleting the .ldb file before each database call?

One more thing. The database is on a Novell Server and I heard that
sometimes windows and Novell doesn't communicate to well and that perhaps
Novell never gets the message that the database is closed. Is this possible
and if so, what could be the workaround?

/Miro


"Robbe Morris [C# MVP]" wrote:
[color=blue]
> Access is not a good fit for web applications. I've seen your
> error occur often times when you don't properly close
> the connection "in every instance" and the lock file
> gets left.
>
> --
> Robbe Morris - 2004/2005 Microsoft MVP C#
> http://www.masterado.net
>
>
>
>
>
> "Miro" <Miro@discussions.microsoft.com> wrote in message
> news:18C98472-C6B4-4BC8-8217-0DD5937527AC@microsoft.com...[color=green]
> > I've read a couple of threads on this error but none of them could help me
> > so
> > I'm posting myself.
> >
> > When I try open and read (not update) an ACCESS database on a network
> > share
> > I occasionally get:
> >
> > "Could not use ''; file already in use." error.
> >
> > This always happens when the database is open but sometimes even when it's
> > not. Not manually anyway. I consequently use DataAdapter.Fill() method
> > which
> > should close the connection, right? Anyway, It must work even when the
> > database is open (not design mode). It does so when I run the application
> > against a database on the webbserver. What's the difference when its on a
> > network share? The IUSR has full rights on the database-folder. And as I
> > said
> > earlier it works, but not always so it's unlikely a basic security
> > problem.
> > There must be some way to force ASP.NET to read an open database. Can
> > anybody
> > please help me?
> >
> > /Miro[/color]
>
>
>[/color]
Closed Thread