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

Recommended Answers

All 22 Replies

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.

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

ViRiPuff

no worries - let me know how you get on

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

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?

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

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

ViRiPuff

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

what line of your code is the error on?

The line with the error is the following

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

ViRiPuff

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

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

sorry, try this:

response.write(server.mappath("/"))

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

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

Hi

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

ViRiPuFF

sorry it meant to say 'is'

is the same connection string in all your pages?

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

ViRiPuff

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

connstr.open()

constr.close()

Yes I'm opening and closing.

The problem is the DB permissions. Once I upload the DB it looses all the permissions ie Everyone has full read/write access is lost.

I had to upload a new version of the DB because the original DB on the host corrupted due to a power cut whilst I was editing it this afternoon.

Once uploaded the host has functionality where the permissions may be set ie using FTP. The problem is this particular host's functionality to set the permissions does not understand commands comming from a windows based FTP. And so I can't set the permissions remotely. So i.m back to square one.

ViRiPuFF

just get the host to set the permissions, they shouldnt have any problem doing this. The DB shouldnt loose its security settings unless there is a problem on the hosts side.

Does it happen eveytime this way?

Yes it always happens like this becuase as you say there is a problem at the host. I can't set the permissions from a windows based ftp.

I've been looking for a work around to this with dubious results.

ViRiPuFF

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.