Forum Home Forum Home > Legacy Products > SalesCart Standard / PRO / SQL
  New Posts New Posts RSS Feed - Could not open data connection
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedCould not open data connection

 Post Reply Post Reply
Author
Message
kdonovan View Drop Down
Newbie
Newbie


Joined: July/12/06
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kdonovan Quote  Post ReplyReply Direct Link To This Post Topic: Could not open data connection
    Posted: July/13/06 at 5:22pm
I can't seem to get past the following error when I add a product to my cart.

Could not open data connection. Error:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
The Invalid ConnectionString is defined as: False

I'm using FP2003 on a Windows 2K3 server and SalesCart 5. I've verified my IIS6 and NTFS permissions on the /fpdb directory as well as on the shop.mdb file. I've even tried going the System DSN route, but the error remains.

Even getting the error to change would be a step in the right direction. Any help would be deeply appreciated.
Back to Top
mikeb View Drop Down
Admin Group
Admin Group
Avatar

Joined: March/17/04
Location: United States
Status: Offline
Points: 194
Post Options Post Options   Thanks (0) Thanks(0)   Quote mikeb Quote  Post ReplyReply Direct Link To This Post Posted: July/14/06 at 10:05am
The database connection you have sepcified is either wrong or the permissions on the database are wrong. This message can't be anything other than those 2 problems.
Back to Top
kdonovan View Drop Down
Newbie
Newbie


Joined: July/12/06
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kdonovan Quote  Post ReplyReply Direct Link To This Post Posted: July/14/06 at 11:53am
It just doesn't make any sense. The connection string looks like: Driver={Microsoft Access Driver (*.mdb)};PROVIDER=MSDASQL;Dbq=DriveLetter:\mypath\fpdb\shop. mdb;
I've even used DSN=myDSN;DRIVER={Microsoft Access Driver (*.mdb)}

For NTFS, IIS_WPG permission on /fpdb includes Read & Execute, List Folder Contents, and Read. The IUSR account has everything except full control.

NTFS on shop.mdb itself includes everything except full control for IIS_WPG and for the IUSR account.

For IIS, /fpdb and shop.mdb permissions include read and write access and scripts only Execute permission.

Are there other .asa files that need editing other than global.asa and cgi-bin/SalesCart.asa?

Can you think of another server setting that might be preventing odbc communication?
Back to Top
mikeb View Drop Down
Admin Group
Admin Group
Avatar

Joined: March/17/04
Location: United States
Status: Offline
Points: 194
Post Options Post Options   Thanks (0) Thanks(0)   Quote mikeb Quote  Post ReplyReply Direct Link To This Post Posted: July/14/06 at 12:08pm
Originally posted by kdonovan kdonovan wrote:


Are there other .asa files that need editing other than global.asa and cgi-bin/SalesCart.asa?

Can you think of another server setting that might be preventing odbc communication?


No....there are no other files and although there could be some wierd/obscure things like ODBC driver is out of date on server---I sincerely doubt it. 99.99999999% of the problem its not pointing to the right database.

Are you running frontPage?
If so, you also have that FrontPage bug to contend with where it "rewrites" and "breaks" your database connection string. Also, if its FrontPage, you can make FrontPage create the connection string and simply reference the FrontPage connection string. Of course, the FrontPage bug there, breaks its on FrontPage code as well.

Hard to troubleshoot this without seeing whats in the .asa file or getting on the server.

Edited by mike
Back to Top
kdonovan View Drop Down
Newbie
Newbie


Joined: July/12/06
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kdonovan Quote  Post ReplyReply Direct Link To This Post Posted: July/14/06 at 1:49pm
Hmmm. It's certainly pointing correctly to shop.mdb. I copied the path right out of Windows Explorer. And I also set up a DSN, which let's you browse right to the .mdb file.

I am using the FrontPage version of SalesCart, but I've been editing the connection string directly on the server with Visual Studio. Could FP still be the culprit somehow? Would it help if I sent you my global.asa file? I suppose that I could post it here (sans usernames and pwds, etc.). Please let me know. Thanks.
Back to Top
mikeb View Drop Down
Admin Group
Admin Group
Avatar

Joined: March/17/04
Location: United States
Status: Offline
Points: 194
Post Options Post Options   Thanks (0) Thanks(0)   Quote mikeb Quote  Post ReplyReply Direct Link To This Post Posted: July/14/06 at 1:55pm
Originally posted by kdonovan kdonovan wrote:

Hmmm. It's certainly pointing correctly to shop.mdb. I copied the path right out of Windows Explorer. And I also set up a DSN, which let's you browse right to the .mdb file.

It needs to be the path on the server not on your local computer.
Originally posted by kdonovan kdonovan wrote:


I am using the FrontPage version of SalesCart, but I've been editing the connection string directly on the server with Visual Studio. Could FP still be the culprit somehow? Would it help if I sent you my global.asa file? I suppose that I could post it here (sans usernames and pwds, etc.). Please let me know. Thanks.

Cut and past it here and then modify the real path and any username, password or other sensitive information as to something different. Eventhough it will be different, the jist of the problem may be evident and/or will be transferrable to the real path. Just replace any real sensitive information with fake alternatives...if you know what I mean.
Back to Top
kdonovan View Drop Down
Newbie
Newbie


Joined: July/12/06
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kdonovan Quote  Post ReplyReply Direct Link To This Post Posted: July/14/06 at 4:04pm
I know what you mean :-)
I apologize for the length of the file. For the sake of brevity, I removed all of those Session variables towards the bottom. Let me know if you see anything . . .
============================================
'     Copyright (C) 1995-2004 ComCity. All Rights Reserved
'     SalesCart 5
'     
'     File: global.asa
'     Revision: 4
'     ASP file that controls application and session-wide variables
'     
'     DO NOT CHANGE- UNLESS YOU REALLY KNOW WHAT YOU'RE DOING!
'     
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
     '==FrontPage Generated - startspan==
     Dim FrontPage_UrlVars(1)
     '--Project Data Connection
           Application("SalesCart1_ConnectionString") = "Driver={Microsoft Access Driver (*.mdb)};PROVIDER=MSDASQL;Dbq=Drive:\path\mysite.com\fpdb\sh op.mdb;"
           'Application("SalesCart1_ConnectionString") = "DSN=myDSN;DRIVER={Microsoft Access Driver (*.mdb)}"
           Application("SalesCart1_ConnectionTimeout") = 15
           Application("SalesCart1_CommandTimeout") = 30
           Application("SalesCart1_CursorLocation") = 3
           Application("SalesCart1_RuntimeUserName") = ""
           Application("SalesCart1_RuntimePassword") = ""
     '--
     Application("FrontPage_UrlVars ") = FrontPage_UrlVars
     '==FrontPage Generated - endspan==
End Sub
Sub FrontPage_StartSession
     On Error Resume Next
     if Len(Application("FrontPage_VRoot")) > 0 then Exit Sub
     
     sFile = "global.asa"
     sRootPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
     if Left(sRootPath,1) = "/" then sSep = "/" else sSep = "\"
     if Right(sRootPath,1) <> sSep then sRootPath = sRootPath & sSep
     sRootPath = sRootPath & sFile
     
     ' discover the VRoot for the current page;
     ' walk back up VPath until we match VRoot
     Vroot = Request.ServerVariables("PATH_INFO")
     iCount = 0
     do while Len(Vroot) > 1
           idx = InStrRev(Vroot, "/")
           if idx > 0 then
                Vroot = Left(Vroot,idx)
           else
                ' error; assume root web
                Vroot = "/"
           end if
           if Server.MapPath(Vroot & sFile) = sRootPath then exit do
           if Right(Vroot,1) = "/" then Vroot = Left(Vroot,Len(Vroot)-1)
           iCount = iCount + 1
           if iCount > 100 then
                ' error; assume root web
                Vroot = "/"
                exit do
           end if
     loop
     ' map all URL= attributes in _ConnectionString variables
     Application.Lock
     if Len(Application("FrontPage_VRoot")) = 0 then
           Application("FrontPage_VRoot") = Vroot
           UrlVarArray = Application("FrontPage_UrlVars")
           for i = 0 to UBound(UrlVarArray)
                 if Len(UrlVarArray(i)) > 0 then FrontPage_MapUrl(UrlVarArray(i))
           next
     end if
     Application.Unlock
End Sub
Function FrontPage_FileExists(fspath)
On Error Resume Next
FrontPage_FileExists = False
Set fs = CreateObject("Scripting.FileSystemObject")
Err.Clear
Set istream = fs.OpenTextFile(fspath)
if Err.Number = 0 then
FrontPage_FileExists = True
istream.Close
end if
Set istream = Nothing
Set fs = Nothing
End Function
Sub FrontPage_MapUrl(AppVarName)
     ' convert URL attribute in conn string to absolute file location
     strVal = Application(AppVarName)
     strKey = "URL="
     idxStart = InStr(strVal, strKey)
     If idxStart = 0 Then Exit Sub
     strBefore = Left(strVal, idxStart - 1)
     idxStart = idxStart + Len(strKey)
     idxEnd = InStr(idxStart, strVal, ";")
     If idxEnd = 0 Then
           strAfter = ""
           strURL = Mid(strVal, idxStart)
     Else
           strAfter = ";" & Mid(strVal, idxEnd + 1)
           strURL = Mid(strVal, idxStart, idxEnd - idxStart)
     End If
     strOut = strBefore & Server.MapPath(Application("FrontPage_VRoot") & strURL) & strAfter
     Application(AppVarName) = strOut
End Sub
Sub Application_OnEnd
End Sub
Sub Session_OnStart
FrontPage_StartSession '==FrontPage Generated==
SC_StartSession '==SalesCart Generated==
     FrontPage_ConvertFromODBC '==FrontPage Generated==
End Sub
Sub SC_StartSession()
On Error Resume Next
'       A whole bunch of session variables were here.
Session("orderid") = 0
Session("mallid") = 0
End Sub
Sub Session_OnEnd
End Sub
Sub FrontPage_ConvertFromODBC
     On Error Resume Next
     if Len(Application("ASP_OS")) > 0 then exit sub
     str = "_ConnectionString"
     slen = Len(str)
     set oKnown = Server.CreateObject("Scripting.Dictionary")
     oKnown.Add "DRIVER",""
     oKnown.Add "DBQ",""
     oKnown.Add "SERVER",""
     oKnown.Add "DATABASE",""
     oKnown.Add "UID",""
     oKnown.Add "PWD",""
     Application.Lock
     For each item in Application.Contents
           if UCase(Right(item,slen)) = UCase(str) then
                sName = Left(item,Len(item)-slen)
                sConn = Application(item)
                 if InStr(LCase(sConn),"provider=") < 1 and Len(Application(sName & "_ConnectionTimeout"))>0 then
                      sArr = Split(sConn,";")
                      set oDict = Server.CreateObject("Scripting.Dictionary")
                      bUnknown = False
                      for i = 0 to UBound(sArr)
                           s = sArr(i)
                           idx = InStr(s,"=")
                           s Key = UCase(Trim(Left(s,idx-1)))
                           s Val = Trim(Mid(s,idx+1))
                           oDict.Add sKey, sVal
                           if Not oKnown.Exists(sKey) then bUnknown = True
                      next
                      if bUnknown = False and oDict.Exists("DRIVER") then
                           s Drv = oDict.Item("DRIVER")
                           s New = ""
                           if InStr(sDrv,"Microsoft Access") > 0 and oDict.Exists("DBQ") and not (oDict.Exists("UID") or oDict.Exists("PWD")) then
                                 s New = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & oDict.Item("DBQ")
                           elseif InStr(sDrv,"SQL Server") > 0 and oDict.Exists("SERVER") and oDict.Exists("DATABASE") then
                                 s New = "Provider=SQLOLEDB;Data Source=" & oDict("SERVER") & ";Initial Catalog=" & oDict("DATABASE")
                                if oDict.Exists("UID") then sNew = sNew & ";User ID=" & oDict("UID")
                                if oDict.Exists("PWD") then sNew = sNew & ";Password=" & oDict("PWD")
                           end if
                           if sNew <> "" then
                                 Application(item) = sNew
                           end if
                      end if
                      set oDict = Nothing
                 end if
           end if
     Next
     Application.Unlock
     Set oKnown = Nothing
End Sub
</SCRIPT>
<head><title>Web Site Settings for Active Server Pages</title><html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:000">
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:connectionstatus msdt:dt="string">SalesCart1=1</mso:connectionstatus> ;
</mso:CustomDocumentProperties>
</xml><![endif]-->
</head>
Back to Top
mikeb View Drop Down
Admin Group
Admin Group
Avatar

Joined: March/17/04
Location: United States
Status: Offline
Points: 194
Post Options Post Options   Thanks (0) Thanks(0)   Quote mikeb Quote  Post ReplyReply Direct Link To This Post Posted: July/14/06 at 4:48pm
1) You should comment this line with a '. Its the FrontPage bug.

       'FrontPage_Convert FromODBC '==FrontPage Generated==

2) Not everything is here. What connection string is the SalesCart.asa file looking for?

3) This does not look right...
Application("SalesCart1_ConnectionString") = "Driver={Microsoft Access Driver (*.mdb)};PROVIDER=MSDASQL;Dbq=Drive:\path\mysite.com\fpdb\sh op.mdb;"

a) Drive: (Should be c:\ or d:\)
b) sh op.mdb (Should be shop.mdb [but I would rename that for security reasons]
c) PROVIDER=MSDASQl. I'm not aware of this provider. You look like your mixing a SQL provider with an Access provider.
d) Dbq means you don't need the drive letter.

Summary: you should use FrontPage to recreate this connection string because its wrong. Or try something more like this where the path and database name are corrected for your application.
Application("SalesCart1_ConnectionString") =Driver={Microsoft Access driver (*.mdb)};dbq=c:\webshare\wwwroot\somewebsite\hiddendb\sc_sho p_renamed.mdb;

-or-
           Application("Database1_ConnectionString") = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=hidden_fp_db/some_shop_db.mdb"
Back to Top
kdonovan View Drop Down
Newbie
Newbie


Joined: July/12/06
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kdonovan Quote  Post ReplyReply Direct Link To This Post Posted: July/16/06 at 9:06pm
Okay, I made some changes, and still no luck. In response to you suggestions above:
1)I commented out that line.
2)Here is the connection string in SalesCart.asa: Session("ConnectionString") = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=C:\mypath\shop.mdb" (where "path" repsents the actual path)
3)The global.asa path now looks similar to the connection string above: Application("Database1_ConnectionString") = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=C:\mypath\shop.mdb"

a)The database used to be located on a drive other than c: or d: -- but I moved it to c: and set up a web share to the rest of the application. The rest of the application is on a different drive. I used Access to establish the connection, and then I edited the connection string once I moved it to the remote web server.

I believe that all of the permissions are correct, but let's tackle the connection strings first. Do they appear correct now? If you'd like me to re-copy the .asa file, I will.
Thanks.
Back to Top
mikeb View Drop Down
Admin Group
Admin Group
Avatar

Joined: March/17/04
Location: United States
Status: Offline
Points: 194
Post Options Post Options   Thanks (0) Thanks(0)   Quote mikeb Quote  Post ReplyReply Direct Link To This Post Posted: July/17/06 at 9:18am
**DBQ=URL requires that it be a relative URL. You CANNOT use C: there. It sounds like you have the database now "outside" of the URL of the website. That is good for security but it will require you to use a DSN.

Try using FrontPage to find the database and let it define the connection string instead of editing the file directly.
Back to Top
kdonovan View Drop Down
Newbie
Newbie


Joined: July/12/06
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kdonovan Quote  Post ReplyReply Direct Link To This Post Posted: July/17/06 at 10:47am
Okay. I set up a DSN. FrontPage "verified" the connection, but I still receive the error in question. I also verified that session state is enabled. I was hoping that it wasn't since SalesCart holds the connection string in session. IUSR has modify permissions . . . Thoughts?
Back to Top
mikeb View Drop Down
Admin Group
Admin Group
Avatar

Joined: March/17/04
Location: United States
Status: Offline
Points: 194
Post Options Post Options   Thanks (0) Thanks(0)   Quote mikeb Quote  Post ReplyReply Direct Link To This Post Posted: July/17/06 at 12:54pm
Ok now post the global.asa and salescart.asa.
Back to Top
kdonovan View Drop Down
Newbie
Newbie


Joined: July/12/06
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kdonovan Quote  Post ReplyReply Direct Link To This Post Posted: July/17/06 at 10:34pm
Okay. Two things. I was able to fix the connection string issue. I found another connection string amongst the session variables in global.asa. I added the provider information there too. The "good and bad" news is that while the original error that started this thread disappeared, I'm getting a 500 Internal error in its place. I checked the Windows event viewer because oftentimes non-descript errors like 500 errors show up in the logs. But I did't see anthing that helped. Nonetheless, I'm copying the .asa files, hoping that you might see something helpful. Does a 500 error represent a permissions issue? Thanks for everything.

'     Copyright (C) 1995-2004 ComCity. All Rights Reserved
'     SalesCart 5
'     
'     File: global.asa
'     Revision: 4
'     ASP file that controls application and session-wide variables
'     
'     DO NOT CHANGE- UNLESS YOU REALLY KNOW WHAT YOU'RE DOING!
'     
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
     '==FrontPage Generated - startspan==
     Dim FrontPage_UrlVars(2)
     '--Project Data Connection
           Application("Database1_ConnectionString") = "DSN=mydsn;DRIVER={Microsoft Access Driver (*.mdb)}"
           FrontPage_UrlVars(1) = "Database1_ConnectionString"
           Application("Database1_ConnectionTimeout") = 15
           Application("Database1_CommandTimeout") = 30
           Application("Database1_CursorLocation") = 3
           Application("Database1_RuntimeUserName") = ""
           Application("Database1_RuntimePassword") = ""
     '--
     Application("FrontPage_UrlVars ") = FrontPage_UrlVars
     '==FrontPage Generated - endspan==
End Sub
Sub FrontPage_StartSession
     On Error Resume Next
     if Len(Application("FrontPage_VRoot")) > 0 then Exit Sub
     
     sFile = "global.asa"
     sRootPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
     if Left(sRootPath,1) = "/" then sSep = "/" else sSep = "\"
     if Right(sRootPath,1) <> sSep then sRootPath = sRootPath & sSep
     sRootPath = sRootPath & sFile
     
     ' discover the VRoot for the current page;
     ' walk back up VPath until we match VRoot
     Vroot = Request.ServerVariables("PATH_INFO")
     iCount = 0
     do while Len(Vroot) > 1
           idx = InStrRev(Vroot, "/")
           if idx > 0 then
                Vroot = Left(Vroot,idx)
           else
                ' error; assume root web
                Vroot = "/"
           end if
           if Server.MapPath(Vroot & sFile) = sRootPath then exit do
           if Right(Vroot,1) = "/" then Vroot = Left(Vroot,Len(Vroot)-1)
           iCount = iCount + 1
           if iCount > 100 then
                ' error; assume root web
                Vroot = "/"
                exit do
           end if
     loop
     ' map all URL= attributes in _ConnectionString variables
     Application.Lock
     if Len(Application("FrontPage_VRoot")) = 0 then
           Application("FrontPage_VRoot") = Vroot
           UrlVarArray = Application("FrontPage_UrlVars")
           for i = 0 to UBound(UrlVarArray)
                 if Len(UrlVarArray(i)) > 0 then FrontPage_MapUrl(UrlVarArray(i))
           next
     end if
     Application.Unlock
End Sub
Function FrontPage_FileExists(fspath)
On Error Resume Next
FrontPage_FileExists = False
Set fs = CreateObject("Scripting.FileSystemObject")
Err.Clear
Set istream = fs.OpenTextFile(fspath)
if Err.Number = 0 then
FrontPage_FileExists = True
istream.Close
end if
Set istream = Nothing
Set fs = Nothing
End Function
Sub FrontPage_MapUrl(AppVarName)
     ' convert URL attribute in conn string to absolute file location
     strVal = Application(AppVarName)
     strKey = "URL="
     idxStart = InStr(strVal, strKey)
     If idxStart = 0 Then Exit Sub
     strBefore = Left(strVal, idxStart - 1)
     idxStart = idxStart + Len(strKey)
     idxEnd = InStr(idxStart, strVal, ";")
     If idxEnd = 0 Then
           strAfter = ""
           strURL = Mid(strVal, idxStart)
     Else
           strAfter = ";" & Mid(strVal, idxEnd + 1)
           strURL = Mid(strVal, idxStart, idxEnd - idxStart)
     End If
     strOut = strBefore & Server.MapPath(Application("FrontPage_VRoot") & strURL) & strAfter
     Application(AppVarName) = strOut
End Sub
Sub Application_OnEnd
End Sub
Sub Session_OnStart
FrontPage_StartSession '==FrontPage Generated==
SC_StartSession '==SalesCart Generated==
'     FrontPage_ConvertFromODBC '==FrontPage Generated==
End Sub
Sub SC_StartSession()
On Error Resume Next
'       Do session specific initialization
Session("orderid") = 0
Session("mallid") = 0
Session("ConnectionString") = "DSN=mydsn;DRIVER={Microsoft Access Driver (*.mdb)}"
End Sub
Sub Session_OnEnd
End Sub
</SCRIPT>
<head><title>Web Site Settings for Active Server Pages</title><html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:connectionstatus msdt:dt="string">SalesCart1=1 Database1=1</mso:connectionstatus>
</mso:CustomDocumentProperties>
</xml><![endif]-->
</head>


<SCRIPT LANGUAGE=VBScript RUNAT=Server>
'     Copyright (C) 1995-2004 ComCity. All Rights Reserved
'     SalesCart 5
'     
'     File: SalesCart.asa
'     Revision: 4
'     ASP file that controls application and session-wide variables
'     
'     DO NOT CHANGE- UNLESS YOU REALLY KNOW WHAT YOU'RE DOING!
'     
On Error Resume Next
'       Do session specific initialization
Session("ConnectionString") = "DSN=mydsn;DRIVER={Microsoft Access Driver (*.mdb)}"
</SCRIPT>
Back to Top
kdonovan View Drop Down
Newbie
Newbie


Joined: July/12/06
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kdonovan Quote  Post ReplyReply Direct Link To This Post Posted: July/17/06 at 10:57pm
Here is the more descriptive error:
Type mismatch: 'FGETVar'
/cgi-bin/view1.asp, line 2

Thanks.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.04
Copyright ©2001-2015 Web Wiz Ltd.

Copyright 2015 by ComCity® LLC and SalesCart™.  All Rights Reserved