|
 |
access_asp thread: Accessing an Access XP database from .NET/VB App
Message #1 by "D.L. Barton" <dlbarton@s...> on Wed, 5 Feb 2003 07:02:54
|
|
I've accomplished about 1/2 of what I want to with an application using
VS.NET and VB. I'm accessing an Access XP database and have used
Beginning VB.NET Web Programming in Visual Studio .NET Book to help me
out. I'm running into a few problems figuring out if I should use the
OLEDB Jet database driver or the ODBC driver which you have to download
from the MS Website. Thus far I've found the ODBC driver to work for
most rudimentry function, but many of the features of the objects are
missing so that using the Dababound Grid and generic ODBCConnection
DataConnection, etc. objects (from the Toolbox). Alas, I believe that I'd
like to use the OLEDB driver. My problem here is that, as directed in
the book, much of my code refers to a connection "key" in Web.config.
This works great with the following: <add
key="cnIGLA.ConnectionString" value="Driver={Microsoft Access Driver
(*.mdb)};DBQ=c:\inetpub\wwwroot\igla\dbase\igla.mdb" />
, but I have yet to be successful at finding a proper 'value' for the
connection string that works with the OLEDB driver. I've tried copying
and pasting from connection strings in properties of other objects, etc.
but they never seem to work.
Alas, any help you can provide would be greatly appreciated. BTW: Is
there any good reason why I should, shouldn't be using the ODBC driver,
or the OLEDB driver? It seems to me that the OLEDB driver and
accompanying objects are richer and more complete.
Thanks
darrique
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 5 Feb 2003 18:00:33 +1100
|
|
For OLEDB Provider:
value="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\inetpub\wwwroot\igla\dbase\igla.mdb"
You probably shouldn't be storing the database inside the webroot. If you
do, you run the risk that someone can download your database by typing in
the URL, eg http://localhost/igla/dbase/igla.mdb
If you do keep the .mdb file inside the webroot, make sure you remove
Read/Script permissions via the IIS MMC Snapin
As to ODBC -vs- OLEDB. I've found (over many years) that the OLEDB Provider
is much more stable than the ODBC driver. Additionally, using the ODBC
Driver requires an additional layer, since all access to ODBC drivers
actually passes through the generic "OLEDB Provider for ODBC Drivers".
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "D.L. Barton" <dlbarton@s...>
Subject: [access_asp] Accessing an Access XP database from .NET/VB App
: I've accomplished about 1/2 of what I want to with an application using
: VS.NET and VB. I'm accessing an Access XP database and have used
: Beginning VB.NET Web Programming in Visual Studio .NET Book to help me
: out. I'm running into a few problems figuring out if I should use the
: OLEDB Jet database driver or the ODBC driver which you have to download
: from the MS Website. Thus far I've found the ODBC driver to work for
: most rudimentry function, but many of the features of the objects are
: missing so that using the Dababound Grid and generic ODBCConnection
: DataConnection, etc. objects (from the Toolbox). Alas, I believe that I'd
: like to use the OLEDB driver. My problem here is that, as directed in
: the book, much of my code refers to a connection "key" in Web.config.
: This works great with the following: <add
: key="cnIGLA.ConnectionString" value="Driver={Microsoft Access Driver
: (*.mdb)};DBQ=c:\inetpub\wwwroot\igla\dbase\igla.mdb" />
: , but I have yet to be successful at finding a proper 'value' for the
: connection string that works with the OLEDB driver. I've tried copying
: and pasting from connection strings in properties of other objects, etc.
: but they never seem to work.
: Alas, any help you can provide would be greatly appreciated. BTW: Is
: there any good reason why I should, shouldn't be using the ODBC driver,
: or the OLEDB driver? It seems to me that the OLEDB driver and
: accompanying objects are richer and more complete.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "D.L. Barton" <dlbarton@s...> on Thu, 6 Feb 2003 01:28:11
|
|
Okay, I did this and think it worked like once or twice. I cannot recall
EXACTLY what happened then. I may have opened Access to tweak the
database a minute. Then tried to run it again, and got this error
message: Exception Details: System.Data.OleDb.OleDbException: The
Microsoft Jet database engine cannot open the
file 'c:\inetpub\wwwroot\igla\dbase\IGLA.mdb'. It is already opened
exclusively by another user, or you need permission to view its data.
I mucked around with the security for a bit and got various other errors,
like things having to do with the workgroup file, etc. Then built a
completely new database and imported all the objects from the original
one with absolutely NO security on it. I've even modified the value field
to be: value="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\inetpub\wwwroot\igla\dbase\igla.mdb;Mode=Share Deny None;User
ID=Admin" />. and still get this error message.
I know that the database opens, even in VS, cause I've created a
connection to it and can open, view, etc. it in the Server Explorer.
ARG!!!
Message #4 by "Ken Schaefer" <ken@a...> on Thu, 6 Feb 2003 17:26:43 +1100
|
|
Hi,
If you have the database open in Access, (especially if you are in any of
the design windows) you will not be able to access the database from ASP or
ASP.Net (or any other client). Likewise, if you have it open anyplace else
(eg from within Visual Studio, Visual Basic, Visual Interdev etc). You need
to close these.
If you don't have it open anyplace else, check then NTFS permissions on for
the folder that the .mdb file is in. When you (or ASP.Net or anyone else)
opens an Access database, an .ldb lockfile is created. If the lockfile can't
be created, or it can't be deleted, then the database can't be opened. Make
sure that the ASPNet account has Change permissions on that folder
(RWXD) -or- it has RW permissions and CREATOR/OWNER has Full Control (since
ASPNet creates the .ldb file, it is the owner and can delete it)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "D.L. Barton" <dlbarton@s...>
Subject: [access_asp] Re: Accessing an Access XP database from .NET/VB App
: Okay, I did this and think it worked like once or twice. I cannot recall
: EXACTLY what happened then. I may have opened Access to tweak the
: database a minute. Then tried to run it again, and got this error
: message: Exception Details: System.Data.OleDb.OleDbException: The
: Microsoft Jet database engine cannot open the
: file 'c:\inetpub\wwwroot\igla\dbase\IGLA.mdb'. It is already opened
: exclusively by another user, or you need permission to view its data.
: I mucked around with the security for a bit and got various other errors,
: like things having to do with the workgroup file, etc. Then built a
: completely new database and imported all the objects from the original
: one with absolutely NO security on it. I've even modified the value field
: to be: value="Provider=Microsoft.Jet.OLEDB.4.0;Data
: Source=c:\inetpub\wwwroot\igla\dbase\igla.mdb;Mode=Share Deny None;User
: ID=Admin" />. and still get this error message.
: I know that the database opens, even in VS, cause I've created a
: connection to it and can open, view, etc. it in the Server Explorer.
: ARG!!!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #5 by "D.L. Barton" <dlbarton@s...> on Wed, 19 Feb 2003 03:14:37
|
|
No, the database is not opened anywhere else. I agree that this must be
some sort of permissions issue, but I'm ENTIRELY incapable of fixing it.
I've gone so far as to add the ASPNet user to the Administrators group
and it still gives me the same error message. I wasn't using NTFS
permissions, but I turned that on, fiddled with it (you cannot,
apparently give permissions to the folder, I'm not sure why). I also
attempted to do sharing permissions for write, etc. and that didn't work.
It doesn't seem to matter what I do, either at the file-system level, or
at IIS level, no matter what scurity mode I use, what permissions level I
give to ASPNet, it still gives me the same error message.
When I move the file to another folder (not under IIS's Default folder
hierarchy), it works fine. So, in the intrim, I'm moving it there so
that I can at least get some work done. It may be that this issue will
not exist at all on the distribution web apps site. If you have any
further assistance, I'm all ears. Thanks already for the help you've
given.
dlb
> Hi,
If you have the database open in Access, (especially if you are in any of
the design windows) you will not be able to access the database from ASP
or
ASP.Net (or any other client). Likewise, if you have it open anyplace else
(eg from within Visual Studio, Visual Basic, Visual Interdev etc). You
need
to close these.
If you don't have it open anyplace else, check then NTFS permissions on
for
the folder that the .mdb file is in. When you (or ASP.Net or anyone else)
opens an Access database, an .ldb lockfile is created. If the lockfile
can't
be created, or it can't be deleted, then the database can't be opened.
Make
sure that the ASPNet account has Change permissions on that folder
(RWXD) -or- it has RW permissions and CREATOR/OWNER has Full Control
(since
ASPNet creates the .ldb file, it is the owner and can delete it)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "D.L. Barton" <dlbarton@s...>
Subject: [access_asp] Re: Accessing an Access XP database from .NET/VB App
: Okay, I did this and think it worked like once or twice. I cannot recall
: EXACTLY what happened then. I may have opened Access to tweak the
: database a minute. Then tried to run it again, and got this error
: message: Exception Details: System.Data.OleDb.OleDbException: The
: Microsoft Jet database engine cannot open the
: file 'c:\inetpub\wwwroot\igla\dbase\IGLA.mdb'. It is already opened
: exclusively by another user, or you need permission to view its data.
: I mucked around with the security for a bit and got various other
errors,
: like things having to do with the workgroup file, etc. Then built a
: completely new database and imported all the objects from the original
: one with absolutely NO security on it. I've even modified the value
field
: to be: value="Provider=Microsoft.Jet.OLEDB.4.0;Data
: Source=c:\inetpub\wwwroot\igla\dbase\igla.mdb;Mode=Share Deny None;User
: ID=Admin" />. and still get this error message.
: I know that the database opens, even in VS, cause I've created a
: connection to it and can open, view, etc. it in the Server Explorer.
: ARG!!!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #6 by "Carl E. Olsen" <carl-olsen@m...> on Tue, 18 Feb 2003 21:05:06 -0600
|
|
You can't run an Access database in a web directory. The permissions do
not allow write access. You can change the permission to write access
in IIS, but that's not a good idea. You want to put the database in a
folder with write permission and then use a DSN or connection string to
connect to it. If you use a remote web server, they will have to
configure it for you. You cannot simply upload a database into a web
site. It will not work.
> -----Original Message-----
> From: D.L. Barton [mailto:dlbarton@s...]
> Sent: Wednesday, February 19, 2003 3:15 AM
> To: Access ASP
> Subject: [access_asp] Re: Accessing an Access XP database from .NET/VB
App
>
> No, the database is not opened anywhere else. I agree that this must
be
> some sort of permissions issue, but I'm ENTIRELY incapable of fixing
it.
> I've gone so far as to add the ASPNet user to the Administrators group
> and it still gives me the same error message. I wasn't using NTFS
> permissions, but I turned that on, fiddled with it (you cannot,
> apparently give permissions to the folder, I'm not sure why). I also
> attempted to do sharing permissions for write, etc. and that didn't
work.
> It doesn't seem to matter what I do, either at the file-system level,
or
> at IIS level, no matter what scurity mode I use, what permissions
level I
> give to ASPNet, it still gives me the same error message.
> When I move the file to another folder (not under IIS's Default folder
> hierarchy), it works fine. So, in the intrim, I'm moving it there so
> that I can at least get some work done. It may be that this issue
will
> not exist at all on the distribution web apps site. If you have any
> further assistance, I'm all ears. Thanks already for the help you've
> given.
>
> dlb
> > Hi,
>
> If you have the database open in Access, (especially if you are in any
of
> the design windows) you will not be able to access the database from
ASP
> or
> ASP.Net (or any other client). Likewise, if you have it open anyplace
else
> (eg from within Visual Studio, Visual Basic, Visual Interdev etc). You
> need
> to close these.
>
> If you don't have it open anyplace else, check then NTFS permissions
on
> for
> the folder that the .mdb file is in. When you (or ASP.Net or anyone
else)
> opens an Access database, an .ldb lockfile is created. If the lockfile
> can't
> be created, or it can't be deleted, then the database can't be opened.
> Make
> sure that the ASPNet account has Change permissions on that folder
> (RWXD) -or- it has RW permissions and CREATOR/OWNER has Full Control
> (since
> ASPNet creates the .ldb file, it is the owner and can delete it)
>
> Cheers
> Ken
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "D.L. Barton" <dlbarton@s...>
> Subject: [access_asp] Re: Accessing an Access XP database from .NET/VB
App
>
>
> : Okay, I did this and think it worked like once or twice. I cannot
recall
> : EXACTLY what happened then. I may have opened Access to tweak the
> : database a minute. Then tried to run it again, and got this error
> : message: Exception Details: System.Data.OleDb.OleDbException: The
> : Microsoft Jet database engine cannot open the
> : file 'c:\inetpub\wwwroot\igla\dbase\IGLA.mdb'. It is already opened
> : exclusively by another user, or you need permission to view its
data.
> : I mucked around with the security for a bit and got various other
> errors,
> : like things having to do with the workgroup file, etc. Then built a
> : completely new database and imported all the objects from the
original
> : one with absolutely NO security on it. I've even modified the value
> field
> : to be: value="Provider=Microsoft.Jet.OLEDB.4.0;Data
> : Source=c:\inetpub\wwwroot\igla\dbase\igla.mdb;Mode=Share Deny
None;User
> : ID=Admin" />. and still get this error message.
> : I know that the database opens, even in VS, cause I've created a
> : connection to it and can open, view, etc. it in the Server Explorer.
> : ARG!!!
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> to unsubscribe send a blank email to leave-access_asp-
> 1112135Q@p...
Message #7 by "Ken Schaefer" <ken@a...> on Wed, 19 Feb 2003 14:23:51 +1100
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Carl E. Olsen" <carl-olsen@m...>
Subject: [access_asp] Re: Accessing an Access XP database from .NET/VB App
: You can't run an Access database in a web directory. The
: permissions do not allow write access.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Of course you can. HTTP permissions have nothing to do with it, because the
OleDbProvider classes don't use HTTP to connect to the .mdb file. The only
relevant permissions are the NTFS (File System) permissions, and you can set
that to Everyone Full Control if you want.
Cheers
Ken
Message #8 by "Ken Schaefer" <ken@a...> on Wed, 19 Feb 2003 14:25:20 +1100
|
|
Hi,
If you have Windows XP Pro, and you are not in a domain, then you need to go
to (in Explorer)
Tools -> Folder Options -> View
and scroll down to "Use Simple File Sharing (Recommended)" and *uncheck*
that box. Then, when you right-click on a folder to bring up the Properties
dialogue, you will see a Permissions tab
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "D.L. Barton" <dlbarton@s...>
Subject: [access_asp] Re: Accessing an Access XP database from .NET/VB App
: No, the database is not opened anywhere else. I agree that this must be
: some sort of permissions issue, but I'm ENTIRELY incapable of fixing it.
: I've gone so far as to add the ASPNet user to the Administrators group
: and it still gives me the same error message. I wasn't using NTFS
: permissions, but I turned that on, fiddled with it (you cannot,
: apparently give permissions to the folder, I'm not sure why). I also
: attempted to do sharing permissions for write, etc. and that didn't work.
: It doesn't seem to matter what I do, either at the file-system level, or
: at IIS level, no matter what scurity mode I use, what permissions level I
: give to ASPNet, it still gives me the same error message.
: When I move the file to another folder (not under IIS's Default folder
: hierarchy), it works fine. So, in the intrim, I'm moving it there so
: that I can at least get some work done. It may be that this issue will
: not exist at all on the distribution web apps site. If you have any
: further assistance, I'm all ears. Thanks already for the help you've
: given.
:
: dlb
: > Hi,
:
: If you have the database open in Access, (especially if you are in any of
: the design windows) you will not be able to access the database from ASP
: or
: ASP.Net (or any other client). Likewise, if you have it open anyplace else
: (eg from within Visual Studio, Visual Basic, Visual Interdev etc). You
: need
: to close these.
:
: If you don't have it open anyplace else, check then NTFS permissions on
: for
: the folder that the .mdb file is in. When you (or ASP.Net or anyone else)
: opens an Access database, an .ldb lockfile is created. If the lockfile
: can't
: be created, or it can't be deleted, then the database can't be opened.
: Make
: sure that the ASPNet account has Change permissions on that folder
: (RWXD) -or- it has RW permissions and CREATOR/OWNER has Full Control
: (since
: ASPNet creates the .ldb file, it is the owner and can delete it)
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "D.L. Barton" <dlbarton@s...>
: Subject: [access_asp] Re: Accessing an Access XP database from .NET/VB App
:
:
: : Okay, I did this and think it worked like once or twice. I cannot recall
: : EXACTLY what happened then. I may have opened Access to tweak the
: : database a minute. Then tried to run it again, and got this error
: : message: Exception Details: System.Data.OleDb.OleDbException: The
: : Microsoft Jet database engine cannot open the
: : file 'c:\inetpub\wwwroot\igla\dbase\IGLA.mdb'. It is already opened
: : exclusively by another user, or you need permission to view its data.
: : I mucked around with the security for a bit and got various other
: errors,
: : like things having to do with the workgroup file, etc. Then built a
: : completely new database and imported all the objects from the original
: : one with absolutely NO security on it. I've even modified the value
: field
: : to be: value="Provider=Microsoft.Jet.OLEDB.4.0;Data
: : Source=c:\inetpub\wwwroot\igla\dbase\igla.mdb;Mode=Share Deny None;User
: : ID=Admin" />. and still get this error message.
: : I know that the database opens, even in VS, cause I've created a
: : connection to it and can open, view, etc. it in the Server Explorer.
: : ARG!!!
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:
.
Message #9 by "D.L. Barton" <dlbarton@s...> on Sat, 22 Feb 2003 01:25:23
|
|
YOU'RE A GENIUS! That appears to have done the trick. As a former (yes,
I'm embarrased to say it), Microsoft Program Manager, you'd have thunk
I'd have been able to figure that out... oh well!
Thanks again!
|
|
 |