View Full Version : ASP Access Upload Problem
Gazzil
10-22-2004, 11:35 AM
Hi all, I am a beginner with ASP and would really appreciate your help!!
I am developing a small database (MS Access) driven products website using ASP (VB). The site works perfectly on my local server (IIS) but as soon as I upload anything to my web space i get the following message:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/Stagg/StaggMain.asp, line 12
I know that the web space is running ASP for me.
Is there something else I need do? I just assumed I make a copy of my local server site on my ASP enabled web space and it'd work!!
I use Dreamweaver MX and I assume it creates all the necessary 'connection' files for me etc etc.
Could really do with your help all...
Many thanks!
Your local IIS site was probably mapping to your database file on your hard drive. Probably something like "C:\Inetpub\wwwroot\Site\file.mdb"
When you move it to the server, the path is no longer valid. A good way to solve this is to replace the path with Server.MapPath("file.mdb")
The server automatically finds the file's path (as long as there's only one you should be okay), and it works even on your local IIS version... so you don't have to switch back and forth when testing.
Gazzil
10-22-2004, 12:49 PM
Hi,
I've check my ASP pages on the site and they refer to:
<!--#include file="../Connections/PMTGaz.asp" -->
which looks correct to me. There doesn't seem to be any reference to my 'C' drive.
Am I right in thinking that as long as I duplicate the structure in my IIS onto the web space then thats all that is needed? Does it produce all of the ODBC information for you??
Many thanks
Gaz
afterburn
10-22-2004, 12:59 PM
The error is a result of the "DSN" or File Path being expected however it does not exist.
Look at the Connection string to the db.
Gazzil
10-22-2004, 01:48 PM
Hi there,
The ASP page in question begins...
<!--#include file="../Connections/PMTGaz.asp" -->
...and the only connection reference I can see is:
var Recordset1 = Server.CreateObject("ADODB.Recordset");
Recordset1.ActiveConnection = MM_PMTGaz_STRING;
The 'PMTGaz.asp' page contains:
<%
// FileName="Connection_odbc_conn_dsn.htm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="true"
// Catalog=""
// Schema=""
var MM_PMTGaz_STRING = "dsn=PMTWEB;uid=gary;pwd=gary;"
%>
I don't seem to be able to locate the 'Connection_odbc_conn_dsn.htm' file though.
Any ideas?
Thanks again, Gaz
afterburn
10-22-2004, 01:49 PM
Do not worry about that ... it looks like documentation more than enything.
The DSN is "PMTWEB", however it does not exist.
Doug G
10-22-2004, 01:51 PM
var MM_PMTGaz_STRING = "dsn=PMTWEB;uid=gary;pwd=gary;"
This line indicates your db connection was through a DSN. You will need a DSN of the same name on the web server. Depending on your hosting, you may be able to create your own DSN or you may need help from the server admin.
Another common problem when you move an Access db to a web host is no write permissions. Make sure the web server has write permissions to the .mdb file. This also may require help from the hosting admin.
Gazzil
10-22-2004, 01:53 PM
ok, apologies for my inexperience, but how has it lost that DSN information when I've uploaded it (using cuteftp might I add).
The DSN connection is established ok on my IIS.
Have I missed something whilst uploading my pages?
Thanks
Gaz
afterburn
10-22-2004, 02:25 PM
You can't create the dsn like your suggesting. ODBC places the file in specified location, if it is a file ODBC connection then it places it in %%SYSTEMDRIVE%%\Common\ODBC or something like that. Or you have to specify the file path the the DSN.
Yeah and on top of that, like Doug said, the permissions will almost certainly need to be set again. Even if the file had full write permissions on your local site, those are all taken away the minute you upload to a web server. Setting up a DSN / permissions is not too difficult, so if you can get in touch with the admin you should be good to go.
Gazzil
10-24-2004, 11:50 AM
Ok guys, many thanks for your help so far...
I'll get in touch with the web provider for some help.
I am very experienced with MS Access (databasing is my job) and I've done HTML sites in the past, but the transition to ASP and the ODBC/DSN thing is certainly testing me!!
I'll let you know how I get on,
Thanks again
Gaz
Conor
10-31-2004, 11:29 AM
The 'PMTGaz.asp' page contains:
<%
// FileName="Connection_odbc_conn_dsn.htm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="true"
// Catalog=""
// Schema=""
var MM_PMTGaz_STRING = "dsn=PMTWEB;uid=gary;pwd=gary;"
%>
I don't seem to be able to locate the 'Connection_odbc_conn_dsn.htm' file though.
Hi Gaz
I take it that you set the database connection up locally through the control panel (ODBC)? This is fine if you are running the thing local, because you have set the database drivers up on your computer. However, normally to run on a host's server you need to create a DNS-less connection. You can do so by doing the following.....
Open your Connections folder then open PMTGaz.asp Delete all the code and copy this
<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
Dim MM_PMTGaz_STRING
MM_cnAigo_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("PMTWEB.mdb")
%>
You see nearly the really end where it says
& Server.MapPath("PMTWEB.mdb")
You need to change the bit in quote marks (PMTWEB.mdb) to the file name of the database, I persume the database is called "PMTWEB.mdb" - if so, then you can leave it as it is. If it's something like gaz.mdb, then change it to
& Server.MapPath("gaz.mdb")
Good luck!
Conor
Gazzil
11-01-2004, 03:50 AM
Ok Conor, I'll give that a whirl.
I did setup my connection using ODBC, however, the connection in Dreamweaver is set to use "DSN on testing server" rather than "use local DSN".
The providers are taking an age to get back to me, so I'll give it a go anyway. Is the PMTgaz.asp page the only page I need amend?
So is it correct that you HAVE to use a DSN-less connection for the web?
Thanks all again
Gaz
Conor
11-01-2004, 11:43 AM
Yep the asp file in the Connections folder is the only one you need to change
Gazzil
11-01-2004, 12:25 PM
I only change the one thats been uploaded right? Whilst testing on my IIS I presume I leave it all as is (DSN)??
What does "MM_cnAigo_STRING" mean?
I am now getting the following??
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/zildjian/Zildjian_ZBT.asp, line 15
Any ideas?
Cheers
Doug G
11-01-2004, 03:38 PM
What does "MM_cnAigo_STRING" mean?
That you're using Dreamweaver probably?
Without seeing any code it's hard to say what's the meaning. I don't have any experience with Dreamweaver.
The error message means your sql statement for the database has an error in it's syntax, or that there are values in your sql string that don't match the database structure.
Conor
11-01-2004, 07:34 PM
Originally posted by Gazzil
I only change the one thats been uploaded right? Whilst testing on my IIS I presume I leave it all as is (DSN)??
What does "MM_cnAigo_STRING" mean?
I am now getting the following??
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/zildjian/Zildjian_ZBT.asp, line 15
Any ideas?
Cheers
Oh gaz - i'm sorry
I copied my connection file over and my connection is called "aigo" - i changed it in the first line, but forgot the change it in the second line. Delete all code in the asp file in connections file and put this in - that might've been what your problem was
conor
<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
Dim MM_PMTGaz_STRING
MM_PMTGaz_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("PMTWEB.mdb")
%>
Gazzil
11-02-2004, 06:36 AM
Conor,
Many thanks! It seems to have worked!!
Thanks to everyone whos helped.
I now know to use a DSN-Less connection in ASP.
The site in question is:
http://www.drumcompany.com/home.html
Thanks again!
entimp
11-02-2004, 06:47 AM
This is a handy script. It will tell you some things regarding your server. One of which is the physical root which may have helped.
Run it from the root of your site dir.
You will need to open it, and change the extension to *.asp as the forums will not allow me to upload an ASP doc.
Conor
11-02-2004, 07:03 AM
Gaz, a tip
The code for the DSN-less connection (as you have at the minute) is as follows
<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
Dim MM_PMTGaz_STRING
MM_PMTGaz_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("PMTWEB.mdb")
%>
You see the lines from FileName -Schema, these don't matter, as they're only comments denoted by the ' mark before it.
change your code to
<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
Dim MM_PMTGaz_STRING
' MM_PMTGaz_STRING = "dsn=PMTWEB;"
MM_PMTGaz_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("PMTWEB.mdb")
%>
Do you see were I'm going? THe second last line is for local testing, the last line for DNS-less. At the minute, it's using the DNS-less connection, however if you try to do things in dreamweaver it won't work. The second last line [the DNS connection] at the minute, it invisable because it's got ' before it.
If you want to edit in dreamweaver, simply take away the ' and the space and put it before the last line - then this becoms a comment.
I know I'm not that good at explaining, but hopefully you'll get the idea.
Conor
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.