[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

Translation from "DSN-Less" to "DSN-Connection"

Dear eXperts.

I have a page where the follwing access is perfect:

DSN-CONNECTION:
strImageProvider = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & server.mappath("../db/intursol.mdb") & "; User Id=admin; Password=;"
conn = strImageProvider
strSqlStmt = "SELECT Update FROM UpdateTable"
Set rs=Server.CreateObject("ADODB.Recordset")
rs.open strSqlStmt, conn


NOW, I had to take over a page which starts with an include file as follows:
<%
// FileName="Connection_odbc_conn_dsn.htm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_intursol_STRING = "dsn=inturcon;"
%>

and continues with:
<!--#include file="Connections/intursol.asp" -->
<%
var rsupdate = Server.CreateObject("ADODB.Recordset");
rsupdate.ActiveConnection = MM_intursol_STRING;              (<-- this is line 5)
rsupdate.Source = "SELECT Update  FROM UpdateTable";
rsupdate.CursorType = 0;
rsupdate.CursorLocation = 2;
rsupdate.LockType = 1;
rsupdate.Open();
var rsupdate_numRows = 0;
%>
...
...
        <strong>Updated <%=(rsupdate.Fields.Item("Update").Value)%><br>

and the error message is:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/index1.asp, line 5

Thanks for your help
B Rgds
Manfred


Send to a Friend    Printer Friendly       
            
      
      
            
            
      
Go Pro with Premium Services
5 times faster
We have the answers you want
Access more IT solutions
Access more IT experts

      
More Answers
Get instant IT solutions that solve your toughest IT problems, provide instant answers, and save thousands of jobs.
Power Search
Search our entire knowledge base for instant solutions.
Fast, organized, and powerful.
Find multiple solutions to your specific question.
Largest Solution Knowledge Base
Worlds largest IT solutions knowledge base.
Find multiple solutions to your specific question.
Personal Knowledge Base
Develop your own personal library of IT solutions.
No More Ads
Enough said.
Customized Navigation
Quick links provide one click navigation to the technology channel of your choice.
Premium Services Instant Help
Instant personal help from an EE concierge.
      
            
            
      
Comment from ThaSmartUno
Date: 04/12/2005 07:27AM PDT
      Comment       

my guess is because you first page is somewhere like /someplace/page.asp

Assuming your web path is "C:\Inetpub\wwwroot"

so server.mappath("../db/intursol.mdb")
maps to "C:\Inetpub\wwwroot\db\intursol.mdb"

and your other page that does not work is somewhere like /some/other/place/page.asp
so server.mappath("../db/intursol.mdb")
maps to "C:\Inetpub\wwwroot\some\other\db\intursol.mdb" which does not exist

Comment from cosmopolita
Date: 04/12/2005 07:45AM PDT
      Your Comment       

Dear Smart1
No, I've no "C:\Inetpub\wwwroot"

The db is on the server on: server.mappath("../db/intursol.mdb")

The starting-page is on: wwwroot\index.asp

I think something has to be changes in the line:
var MM_intursol_STRING = "dsn=inturcon;"
in the above include-file.
0
cosmopolita
Asked:
cosmopolita
  • 10
  • 7
1 Solution
 
cosmopolitaAuthor Commented:
Sorry, I have copied to much !
Here is the important part of my question.

 Dear eXperts.

I have a page where the follwing access is perfect:

DSN-CONNECTION:
strImageProvider = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & server.mappath("../db/intursol.mdb") & "; User Id=admin; Password=;"
conn = strImageProvider
strSqlStmt = "SELECT Update FROM UpdateTable"
Set rs=Server.CreateObject("ADODB.Recordset")
rs.open strSqlStmt, conn


NOW, I had to take over a page which starts with an include file as follows:
<%
// FileName="Connection_odbc_conn_dsn.htm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_intursol_STRING = "dsn=inturcon;"
%>

and continues with:
<!--#include file="Connections/intursol.asp" -->
<%
var rsupdate = Server.CreateObject("ADODB.Recordset");
rsupdate.ActiveConnection = MM_intursol_STRING;              (<-- this is line 5)
rsupdate.Source = "SELECT Update  FROM UpdateTable";
rsupdate.CursorType = 0;
rsupdate.CursorLocation = 2;
rsupdate.LockType = 1;
rsupdate.Open();
var rsupdate_numRows = 0;
%>
...
...
        <strong>Updated <%=(rsupdate.Fields.Item("Update").Value)%><br>

and the error message is:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/index1.asp, line 5

Thanks for your help
B Rgds
Manfred

0
 
fritz_the_blankCommented:
I wonder what is in "Connections/intursol.asp" as this might overwrite your connection!

To test that, try:


<!--#include file="Connections/intursol.asp" -->
<%
var MM_intursol_STRING = "dsn=inturcon;"
var rsupdate = Server.CreateObject("ADODB.Recordset");
rsupdate.ActiveConnection = MM_intursol_STRING;              (<-- this is line 5)
rsupdate.Source = "SELECT Update  FROM UpdateTable";
rsupdate.CursorType = 0;
rsupdate.CursorLocation = 2;
rsupdate.LockType = 1;
rsupdate.Open();
var rsupdate_numRows = 0;
%>

and of course, make sure that you have a DSN with that name.

Finally, I would recommend against the DSN and use an OleDB type connection string.

FtB
0
 
cosmopolitaAuthor Commented:
HI Fritz :-)) Glad to see you again

Re: Your question: the <!--#include file="Connections/intursol.asp" --> is:
<%
// FileName="Connection_odbc_conn_dsn.htm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_intursol_STRING = "dsn=inturcon;"
%>

The one you have sent to me give the same error.

Ref.: Finally, I would recommend against the DSN and use an OleDB type connection string.
Fritz, I have to take care of this page for some friends and they just
loaded it to our/anotherr server and I want to make it running. Tha page was running before.

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
fritz_the_blankCommented:
Okay, this may be the issue. Do you know for certain that a new DSN called inturcon was created on the new server? That is something that the server administrator will need to do. Otherwise, we can work on modifying the MM_intursol_STRING to work on the new environment.

FtB
0
 
cosmopolitaAuthor Commented:
No, I don't know if a DSN called inturcon was created.
0
 
fritz_the_blankCommented:
If it is not created, and I suspect that it hasn't been, then that is why you are getting the error. You are referencing a non-existant DSN.

FtB
0
 
cosmopolitaAuthor Commented:
Yeah, but what is the solution ?
0
 
cosmopolitaAuthor Commented:
I knwo about DSN as much as a cow from mathematics.
Do I have to create this or is it the server, or do 'you' a way ?
0
 
fritz_the_blankCommented:
There are two possibilities:

1) have the server administrator create the DSN
2) change the DSN code to an OleDB type connection and then modify the connection string

I am inclined to try the second approach. What type of database is it?

FtB
0
 
cosmopolitaAuthor Commented:
It's an access 2000 db
0
 
fritz_the_blankCommented:
Okay, and do you know the path to the database?

FtB
0
 
cosmopolitaAuthor Commented:
Oh yes

server.mappath("dbpics/intursol.mdb")

Dear Fritz, even so a DSN-Less Connection is better I would
appreciate if you can help me to make a DSN-Connection as this
page is not under my responsibility and when later something should go
wrong it will be 'my fault' :-)
0
 
fritz_the_blankCommented:
I am afraid that I can't help you to create the DSN as I don't have access to the server--you will need to contact the server administrator to have him/her create the DSN for you. Otherwise, you can try this:

<%
// FileName="Connection_odbc_conn_dsn.htm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var strDataPath = server.mappath("dbpics/intursol.mdb")
var MM_intursol_STRING = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " + strDataPath + "; Mode=Share Deny None;User Id=admin;PASSWORD=;"
%>

FtB

0
 
cosmopolitaAuthor Commented:
No, I get the error

Microsoft JScript runtime  error '800a1391'
'server' is undefined
/Connections/intursol.asp, line 9 [var strDataPath = server.mappath("dbpics/intursol.mdb")]
0
 
cosmopolitaAuthor Commented:
Dear Fritz
Thanks for all - I created the DSN on the server and all is okay.
Uff, all is easy when you know somebody who knows.

Bibi
Manfred
0
 
cosmopolitaAuthor Commented:
Thanks & B Rgds from the Costa del Sol in Spain
Manfred
0
 
fritz_the_blankCommented:
Glad to have helped and good luck.

FtB
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 10
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now