954,577 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Web Server Path for Access DB

Hi

I have just uploaded an Access DB and an .aspx page that writes to the DB. It works fine locally ie IIS.

The problem is that when on the host the db does not get written to. I think its to do with the Source to the DB on my web.config file.

The db is on annex2/annex.eu/wwwroot/annexll.mdb on the host
my code on the Web.config is as follows

<add key="MM_CONNECTION_HANDLER_ss1" value="default_oledb.htm" />
		<add key="MM_CONNECTION_STRING_ss1" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=annexeu/annex2.eu/wwwroot/annexll.mdb;Persist Security Info=False" />
		<add key="MM_CONNECTION_DATABASETYPE_ss1" value="OleDb" />
		<add key="MM_CONNECTION_SCHEMA_ss1" value="" />
		<add key="MM_CONNECTION_CATALOG_ss1" value="" />


THanks

ViRiPuFF
Light Poster
32 posts since Jun 2007
Reputation Points: 16
Solved Threads: 0
 

You should check with your provider with regards to security.

Your not passing any security information in your string (i.e. username and password) and i would have thought that your provider would require this.

ninjaimp
Junior Poster
130 posts since Apr 2008
Reputation Points: 22
Solved Threads: 9
 

Thanks for your help, I'll try to get this from my ISP

ViRiPuff

ViRiPuFF
Light Poster
32 posts since Jun 2007
Reputation Points: 16
Solved Threads: 0
 

no worries - let me know how you get on

ninjaimp
Junior Poster
130 posts since Apr 2008
Reputation Points: 22
Solved Threads: 9
 

The ISP gave me the path C:\HostingSites\Annexeu\Annex2 they said nothing about security.

This is what I've tried since

In my Web.Config

<configuration>

<system.web>
<customErrors mode="On"/>
</system.web>

	<appSettings>
			
<add key="MM_CONNECTION_HANDLER_ss1" value="default_oledb.htm" />
		<add key="MM_CONNECTION_STRING_ss1" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}\db\AnnexII.mdb;" />

		<add key="MM_CONNECTION_DATABASETYPE_ss1" value="OleDb" />
		<add key="MM_CONNECTION_SCHEMA_ss1" value="" />
		<add key="MM_CONNECTION_CATALOG_ss1" value="" />


</appSettings>
</configuration>


In my Returns.aspx file on Page load

Sub Page_Load()
Dim connstr

connstr = String.Format(ConfigurationManager.AppSettings("MM_CONNECTION_STRING_ss1"), Server.MapPath("~"))
End Sub


But it still writes nothing into the Access DB. Nevertheless there no errors coming up which is strange. No errors so I have nothing to go on

ViRiPuff

ViRiPuFF
Light Poster
32 posts since Jun 2007
Reputation Points: 16
Solved Threads: 0
 

just try this connection string in your code first and try something like this:

connstr = "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("AnnexII.mdb")""


This is presuming that the DB is in the root file on your web server.

Also, What is the code you are using to write values to the database?

ninjaimp
Junior Poster
130 posts since Apr 2008
Reputation Points: 22
Solved Threads: 9
 

Hi

Thanks again for your help. I created the site with Dreamweaver 8 and here's the INSERT code

<MM:Insert
runat="server"
CommandText='<%# "INSERT INTO Returns (AccessCode, CallSign, Delivering, DepDate, Email, ETADate, Flag, GrossTons, IMOno, LastDelDate, LastDelPort, NextPort, NoticeDate, NoticeTime, PreviousPort, Q35, VesselName) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" %>'

I'll try your suggestion now. I'll report back in a few minutes

ViRiPuFF
Light Poster
32 posts since Jun 2007
Reputation Points: 16
Solved Threads: 0
 

Hi I tried your suggestion and I get the following error
Compiler Error Message: BC30205: End of statement expected.

ViRiPuff

ViRiPuFF
Light Poster
32 posts since Jun 2007
Reputation Points: 16
Solved Threads: 0
 

Hi again

I've gone back to the path my isp gave me on the Web.config. Its now opening the database but not writing to it.

I know this because when I view the DB using my ftp immediately after trying to write to it from the web the db is locked for about 5 minutes. After about 5 minutes the db is viewable again but no data has been written to it.

Here is the path from the isp
C:\HostingSpaces\annexeu\annex2.eu\wwwroot

ViRiPuff

ViRiPuFF
Light Poster
32 posts since Jun 2007
Reputation Points: 16
Solved Threads: 0
 

what line of your code is the error on?

ninjaimp
Junior Poster
130 posts since Apr 2008
Reputation Points: 22
Solved Threads: 9
 

The line with the error is the following

connstr = "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("AnnexII.mdb")""


ViRiPuff

ViRiPuFF
Light Poster
32 posts since Jun 2007
Reputation Points: 16
Solved Threads: 0
 

ok it may be because the DB is stored in another folder on your server

on a new page just run response.write(server.mappath()) and let us know what it says

and then let me know what folder the db is stored in on your server

ninjaimp
Junior Poster
130 posts since Apr 2008
Reputation Points: 22
Solved Threads: 9
 

Hi
Tried your suggestion and this is what it says

BC30455: Argument not specified for parameter 'path' of 'Public Function MapPath(path As String) As String'

DB is stored in the wwwroot of the host

THanks ViRiPuFF

ViRiPuFF
Light Poster
32 posts since Jun 2007
Reputation Points: 16
Solved Threads: 0
 

sorry, try this:

response.write(server.mappath("/"))
ninjaimp
Junior Poster
130 posts since Apr 2008
Reputation Points: 22
Solved Threads: 9
 

Hi

I finally managed to write to the db with the following:

Web.Config

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
	<appSettings>
	    <add key="MM_CONNECTION_HANDLER_ss1" value="default_oledb.htm" />
		<add key="MM_CONNECTION_STRING_ss1" value="Provider=Microsoft.Jet.OLEDB.4.0;Data      Source=C:\HostingSpaces\annexeu\annex2.eu\wwwroot\AnnexII.mdb;Persist Security Info=False" />
		<add key="MM_CONNECTION_DATABASETYPE_ss1" value="OleDb" />
		<add key="MM_CONNECTION_SCHEMA_ss1" value="" />
		<add key="MM_CONNECTION_CATALOG_ss1" value="" />
</appSettings>
</configuration>


aspx page

Sub Page_Load()
Dim connstr

connstr = String.Format(ConfigurationManager.AppSettings("MM_CONNECTION_STRING_ss1"), Server.MapPath("~"))


The path on the Web.config was given to me by the host.

The strange thing now is I've uploaded another aspx page with exactly the same settings only wrtting to another table and now this one won't write but still gives no errors

ViRiPuFF

ViRiPuFF
Light Poster
32 posts since Jun 2007
Reputation Points: 16
Solved Threads: 0
 

check that the page ios using the same connection string, and not an old one!

ninjaimp
Junior Poster
130 posts since Apr 2008
Reputation Points: 22
Solved Threads: 9
 

Hi

What do you mean by ios input/output? how do i check that

ViRiPuFF

ViRiPuFF
Light Poster
32 posts since Jun 2007
Reputation Points: 16
Solved Threads: 0
 

sorry it meant to say 'is'

is the same connection string in all your pages?

ninjaimp
Junior Poster
130 posts since Apr 2008
Reputation Points: 22
Solved Threads: 9
 

Yes the site contains 2 pages and both use the same connection string referred to in the Web.config. is this not correct?

ViRiPuff

ViRiPuFF
Light Poster
32 posts since Jun 2007
Reputation Points: 16
Solved Threads: 0
 

are you opening and closing the connection with each transaction you do n the table i.e:

connstr.open()

constr.close()
ninjaimp
Junior Poster
130 posts since Apr 2008
Reputation Points: 22
Solved Threads: 9
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You