473,796 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot open Access database in ASP

xg
Hi, I am writing an ASP page which contains the following code:

var MM_DBConn=Serve r.CreateObject( "ADODB.Connecti on");
MM_DBConn.Open( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\trio. mdb;"); // failed on this line
//MM_editQuery is an INSERT sql statement
MM_DBConn.Execu te(MM_editQuery );

When I run this on a Windows 2000 Professional system, I got the following
error:

Microsoft JET Database Engine error '80004005'

Not a valid file name.

And it points out that it failed on the MM_DBConn.Open statement.

However, if I copy the above code to a Visual Basic 6.0 form (on the same
machine) like this:

Private Sub Command1_Click( )
Dim o As Object
Dim rs As Object

Set o = CreateObject("a dodb.connection ")
Call o.open("Provide r=Microsoft.Jet .OLEDB.4.0;Data Source=c:\trio. mdb")
Set rs = o.execute("sele ct count(*) from comments")

End Sub

Everything works. Can someone tell me what went wrong? Thanks!

xg


Mar 19 '06 #1
6 3896

xg wrote:
Hi, I am writing an ASP page which contains the following code:

var MM_DBConn=Serve r.CreateObject( "ADODB.Connecti on");
MM_DBConn.Open( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\trio. mdb;"); // failed on this line
//MM_editQuery is an INSERT sql statement
MM_DBConn.Execu te(MM_editQuery );

When I run this on a Windows 2000 Professional system, I got the following
error:

Microsoft JET Database Engine error '80004005'

Not a valid file name.

And it points out that it failed on the MM_DBConn.Open statement.

However, if I copy the above code to a Visual Basic 6.0 form (on the same
machine) like this:

Private Sub Command1_Click( )
Dim o As Object
Dim rs As Object

Set o = CreateObject("a dodb.connection ")
Call o.open("Provide r=Microsoft.Jet .OLEDB.4.0;Data Source=c:\trio. mdb")
Set rs = o.execute("sele ct count(*) from comments")

End Sub

Everything works. Can someone tell me what went wrong? Thanks!

xg


You have an extra semicolon after the closing parenthesis, after your
connection string. It should look like this:

MM_DBConn.Open( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\trio. mdb;")

You'll also need to do the same on the following line:

MM_DBConn.Execu te(MM_editQuery )

--
Mike Brind

Mar 19 '06 #2
xg wrote:
Hi, I am writing an ASP page which contains the following code:

var MM_DBConn=Serve r.CreateObject( "ADODB.Connecti on");
MM_DBConn.Open( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\trio. mdb;"); // failed on this line
//MM_editQuery is an INSERT sql statement
MM_DBConn.Execu te(MM_editQuery );

When I run this on a Windows 2000 Professional system, I got the
following error:

Microsoft JET Database Engine error '80004005'

Not a valid file name.


This is most likely a permissions problem. If your website is using
Anonymous access, then the IUSR_machinenam e account needs to be granted
Change permissions for the folder containing your database file (which
probably should be located in a subfolder, not in the root).
http://www.aspfaq.com/show.asp?id=2009

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Mar 19 '06 #3
permissions probably

http://www.powerasp.com/content/new/...ermissions.asp

http://www.powerasp.com/content/new/...ermissions.asp
"Mike Brind" <pa*******@hotm ail.com> wrote in message
news:11******** **************@ e56g2000cwe.goo glegroups.com.. .

xg wrote:
Hi, I am writing an ASP page which contains the following code:

var MM_DBConn=Serve r.CreateObject( "ADODB.Connecti on");
MM_DBConn.Open( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\trio. mdb;"); // failed on this line
//MM_editQuery is an INSERT sql statement
MM_DBConn.Execu te(MM_editQuery );

When I run this on a Windows 2000 Professional system, I got the
following
error:

Microsoft JET Database Engine error '80004005'

Not a valid file name.

And it points out that it failed on the MM_DBConn.Open statement.

However, if I copy the above code to a Visual Basic 6.0 form (on the same
machine) like this:

Private Sub Command1_Click( )
Dim o As Object
Dim rs As Object

Set o = CreateObject("a dodb.connection ")
Call o.open("Provide r=Microsoft.Jet .OLEDB.4.0;Data
Source=c:\trio. mdb")
Set rs = o.execute("sele ct count(*) from comments")

End Sub

Everything works. Can someone tell me what went wrong? Thanks!

xg


You have an extra semicolon after the closing parenthesis, after your
connection string. It should look like this:

MM_DBConn.Open( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\trio. mdb;")

You'll also need to do the same on the following line:

MM_DBConn.Execu te(MM_editQuery )

--
Mike Brind

Mar 20 '06 #4
xg
Thanks everyone. I grant the "Modify" permission of
"c:\inetpub\www root\triomotors \" for user "IUSR_DESKT OP" and the code now
looks like this:

var MM_DBConn=Serve r.CreateObject( "ADODB.Connecti on");
MM_DBConn.Open( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\inetp ub\wwwroot\trio motors\trio.mdb ;");
MM_DBConn.Execu te(MM_editQuery );

I still get the same error message. Please help. Thanks!

xg

"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcom> wrote in message
news:eY******** ******@TK2MSFTN GP14.phx.gbl...
xg wrote:
Hi, I am writing an ASP page which contains the following code:

var MM_DBConn=Serve r.CreateObject( "ADODB.Connecti on");
MM_DBConn.Open( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\trio. mdb;"); // failed on this line
//MM_editQuery is an INSERT sql statement
MM_DBConn.Execu te(MM_editQuery );

When I run this on a Windows 2000 Professional system, I got the
following error:

Microsoft JET Database Engine error '80004005'

Not a valid file name.


This is most likely a permissions problem. If your website is using
Anonymous access, then the IUSR_machinenam e account needs to be granted
Change permissions for the folder containing your database file (which
probably should be located in a subfolder, not in the root).
http://www.aspfaq.com/show.asp?id=2009

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Mar 20 '06 #5
It's got nothing to do with your problem, but you really should put the
folder containing the database outside of the wwwroot folder for security
reasons.

A couple questions:
Where is this code located? If it's in one of the event handler subs in
global.asa, then the IWAM_machinenam e account also needs Modify permissions
for the folder containing the database.
Is this database file located on the same machine as the website?
Is your website using Anonymous access? If it's using Integrated
Authentication with Anonymous disabled, then all database users require
Modify permissions for the folder containing the database, not just IUSR and
IWAM.
Have you modified the isolation settings for your application? With some
settings, the IWAM account is doing the work, not the IUSR, so you need to
grant permissions to the IWAM account.

xg wrote:
Thanks everyone. I grant the "Modify" permission of
"c:\inetpub\www root\triomotors \" for user "IUSR_DESKT OP" and the code
now looks like this:

var MM_DBConn=Serve r.CreateObject( "ADODB.Connecti on");
MM_DBConn.Open( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\inetp ub\wwwroot\trio motors\trio.mdb ;");
MM_DBConn.Execu te(MM_editQuery );

I still get the same error message. Please help. Thanks!

xg

"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcom> wrote in message
news:eY******** ******@TK2MSFTN GP14.phx.gbl...
xg wrote:
Hi, I am writing an ASP page which contains the following code:

var MM_DBConn=Serve r.CreateObject( "ADODB.Connecti on");
MM_DBConn.Open( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\trio. mdb;"); // failed on this line
//MM_editQuery is an INSERT sql statement
MM_DBConn.Execu te(MM_editQuery );

When I run this on a Windows 2000 Professional system, I got the
following error:

Microsoft JET Database Engine error '80004005'

Not a valid file name.


This is most likely a permissions problem. If your website is using
Anonymous access, then the IUSR_machinenam e account needs to be
granted Change permissions for the folder containing your database
file (which probably should be located in a subfolder, not in the
root). http://www.aspfaq.com/show.asp?id=2009

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Mar 20 '06 #6
pen

You can try this codes bellow. The Asp page must save under the
directory "c:\inetpub\www root\triomotors \" .
Provider = "Provider=Micro soft.Jet.OLEDB. 4.0;"
DBPath = "Data Source=" & Server.MapPath( "trio.mdb")

Set MM_DBConn = Server.CreateOb ject("ADODB.Con nection")
MM_DBConn.Open Provider & DBPath
MM_DBConn.Execu te("MM_editQuer y")

--
pen
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Mar 30 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2133
by: Jay Chan | last post by:
We have just installed a SQL Server 2000 (SP 3A) onto a computer that has Windows-2003 Server on it. Now, we cannot get access to that database server from other computers. Seem like this may be an issue with Active Directory. Our network consists of Windows-2000 Servers (SP 4) and Windows-2000 workstations and Windows-XP workstations. We also have SQL Server 2000 (SP2) in three Windows-2000 servers. All work fine. Recently, we get a...
8
5483
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
6
18818
by: ultraton | last post by:
While trying to print a report from Access the user receives the following error: Cannot open any more databases. Okay Help Does anyone have any ideas about this behavior? Thank you very much.
5
4486
by: Dave | last post by:
This is my first .NET project (although I am experienced with VS6 and InterDev). I am simply trying to set up a basic ASPX project and connect to an Access database (following the instructions in the .NET Black Book by Templeman and Vitter). I have managed to set up an oleDbConnection, an oleDbAdapter and a dataset, and have added one line of code: oleDbDataAdapter1.Fill(dataSet1); However when this line of code executes I get whole page...
10
2134
by: vvenk | last post by:
Hello: When I tried to use an Access database, I get the following exception: Server Error in '/WebGrid' Application. -------------------------------------------------------------------------------- The Microsoft Jet database engine cannot open the file 'D:\Program Files\Infragistics\NetAdvantage 2005 Volume 2\ASP.NET\Samples\Data\samplebrowser.mdb'. It is already opened exclusively
2
2123
by: Enska | last post by:
I have problems connecting my access database I get information .. I cant use my database and I'm administrator on my computer so permission shutnot bee problem, but I dont know Where is the problem. Can enybody help me!!!! Server Error in '/Koulu/tietokannat' Application. -------------------------------------------------------------------------------- The Microsoft Jet database engine cannot open the file...
4
4622
by: snow | last post by:
Hi all, I have a VB.net program installed in a xp home with sp2,after installation, get error "Cannot open a database from a previous version of your application. The database is a 97 Access file. Could someone tell me what cause this problem? Thanks for your help!
2
2336
by: bbasberg | last post by:
I have been working hard to clean up my code but I am still wondering why all incoming records go to the "AddNew" part of the IF statement and never to the Edit alternative. I believe that it must be because my rs.index never really receives the value from the cell in the spreadsheet that it should use to compare to the corresponding field in the Access DB. I have named the field "rtitle" in Access and made it an index called riskIndex. I am an...
24
5084
by: dancer | last post by:
Using ASP.net 1.1 and Microsoft Access. I received the following error message. Why? I have closed the Access file. I have another very small access file that opens with no trouble with the same code, except a different name for the file. The Microsoft Jet database engine cannot open the file 'C:\Inetpub\wwwroot\Accident.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
1
1695
by: martinbr_2000 | last post by:
I have an access database that has been split and resides in the network share. When the access database is currently being updated by someone, and I try to open the database, I cannot open the file by double clicking on the database filename, for example, \\sharename\testdb.mdb I have to launch MS access, go to the file, then open the file from within MS Access.
0
9528
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10455
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10006
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9052
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7547
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.