I am having an asp site. Until now, I run it with an access mdb database. It runs in iis5. My site runs smoothly with absolutely no problems.
For reasons everyone knows, I want to make a try to change this database to mysql.
I have installed in my pc, mysql server 3.5.23, which my host provider fully supports.
I also have converted the access to mysql, and i have mysql-front application which helps me use mysql with graphic interface.
I must also say that i have made this site with asp-access to work in asp-mysql for windows. All these problems happen when i test it online in my host, which runs iis5 but the back-end database runs in linux.
I face some problems to this updating, from access to mysql.
I have used succesfully asp script statcountx, which gives excellent statistics. No problems at all, with access, not even with mysql for windows(at my pc). But this not works in my host company.
Now, that I try to upgrade to mysql, it does not run.
There is a file config.asp which holds the data path and some other info.
I have changed this in order to point to the new database.
The problem is that the other specific statistics pages, do not work. There is one page for ip's, one for referes etc. No page works. They display errors.
Examples of errors:
For example: ips.asp gives me this error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'
ODBC driver does not support the requested properties.
/wmy/29stats/ips.asp, line 60
Line 60 is this one:rs.Open sSQL,,,adCmdTable
Then i go to see referers. New error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'
ODBC driver does not support the requested properties.
/wmy/29stats/reportref.asp, line 53
Line 53 is this one:
rs.Open sSQL, , , adCmdTable
I also include the config.asp code (i have deleted the username and password, and server name from the file, you must be sure it's ok in the original file i have). You can see this:sConnStats = "driver={MySQL};server=;uid=;pwd=;database=" . The original file is ok, because there is an admin file for these statistics that loads correctly.
Because every page is faulty, that makes me believe that it must be something common between them. Maybe config.asp? But the path to mysql is double-checked right.
Here is the code of config.asp :
<%
'StatCounteX 3.1
'http://www.2enetworx.com/dev/projects/statcountex.asp
sConnStats = "driver={MySQL};server=;uid=;pwd=;database="
'Pre Create the connection and recordset objects
set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
'ADO Constants
'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
'---- CursorLocationEnum Values ----
Const adUseServer = 2
Const adUseClient = 3
'---- CommandTypeEnum Values ----
Const adCmdUnknown = &H0008
Const adCmdText = &H0001
Const adCmdTable = &H0002
Const adCmdStoredProc = &H0004
Const adCmdFile = &H0100
Const adCmdTableDirect = &H0200
sub OpenDB(sConn)
'Opens the given connection and initializes the recordset
conn.open sConn
set rs.ActiveConnection = conn
rs.CursorType = adOpenStatic
end sub
sub CloseDB()
'Closes and destroys the connection and recordset objects
rs.close
conn.close
set rs = nothing
set conn = nothing
end sub
sub w(sText)
'A Quickie ;)
response.write sText & vbCrLf
end sub
'Load Config from DB
'Open Connection
conn.open sConnStats
'Build SqlString
strSql = "SELECT C_ImageLoc "
strSql = strSql & ", C_FilterIP "
strSql = strSql & ", C_ShowLinks "
strSql = strSql & ", C_RefThisServer "
strSql = strSql & ", C_StripPathParameters "
strSql = strSql & ", C_StripPathProtocol "
strSql = strSql & ", C_StripRefParameters "
strSql = strSql & ", C_StripRefProtocol "
strSql = strSql & ", C_StripRefFile "
strSql = strSql & "FROM config WHERE ID = 1"
'Open RecordSet
set rs = conn.Execute(strSql)
'Get Variables
sImageLocation = rs.Fields("C_ImageLoc")
sFilterIps = rs.Fields("C_FilterIP")
bShowLinks = rs.Fields("C_ShowLinks")
bRefThisServer = rs.Fields("C_RefThisServer")
bStripPathParameters = rs.Fields("C_StripPathParameters")
bStripPathProtocol = rs.Fields("C_StripPathProtocol")
bStripRefParameters = rs.Fields("C_StripRefParameters")
bStripRefProtocol = rs.Fields("C_StripRefProtocol")
bStripRefFile = rs.Fields("C_StripRefFile")
'Terminate database connection
rs.Close
conn.close
%>
Here is the code of ips.asp which gives error:
<%
' Sub ListIps
'
' Usage:
' lYear - the numerical year (optional)
' lMonth - the numerical month (optional)
' lDay - the numerical day (optional)
' lHour - the numerical hour (optional)
'
Sub ListIps( lYear, lMonth, lDay, lHour )
sDataSource = ""
If Len(lHour) > 0 Then
sDataSource = "GroupIpsByHourAndDate"
Else
sDataSource = "GroupIpsByDate"
End If
sSQL = "SELECT * From " & sDataSource & " Where 1=1 "
If Len( lYear ) > 0 Then
sSQL = sSQL & "and DatePart(""yyyy"",[Date])=" & lYear & " "
End If
If Len( lMonth ) > 0 Then
sSQL = sSQL & "and DatePart( ""m"", [Date])= " & lMonth & " "
End If
If Len( lDay ) > 0 Then
sSQL = sSQL & "and DatePart( ""d"", [Date])= " & lDay & " "
End If
If Len( lHour ) > 0 Then
sSQL = sSQL & "and Hour= " & lHour & " "
End If
' Connect to the database
OpenDB sconnstats
rs.Open sSQL,,,adCmdTable
%>
<table border=0 cellspacing=1 cellpadding=2 bgcolor = "#ffe4b5">
<tr>
<td bgcolor="#ffe4b5" width=10>»</td>
<td class="smallerheader" bgcolor="#ffe4b5">Stats: Visitors on <%=GetDate%></td>
<td bgcolor="#ffe4b5" width=10></td>
</tr>
<%
do while not rs.eof
sLink = "<a href=""ips.asp?ip=" & rs("IP")
If Len( lYear ) > 0 Then
sLink = sLink & "&year=" & lYear
End If
If Len( lMonth ) > 0 Then
sLink = sLink & "&month=" & lMonth
End If
If Len( lDay ) > 0 Then
sLink = sLink & "&day=" & lDay
End If
If Len( lHour ) > 0 Then
sLink = sLink & "&hour=" & lHour
End If
sLink = sLink & """>" & rs("IP") & "</a>"
%>
<tr>
<td bgcolor="#fffaf0"></td>
<td bgcolor="#fffaf0"><%=sLink%></td>
<td bgcolor="#fffaf0"></td>
</tr>
<%
rs.movenext
loop
%>
<tr>
<td bgcolor="#fffaf0"></td>
<td bgcolor="#fffaf0"><%=rs.RecordCount%> visitors</td>
<td bgcolor="#fffaf0"></td>
</tr>
</table>
<%
conn.close
'set rs=nothing
'set conn=nothing
End Sub
'
' Sub ShowClickPath
'
' Usage:
' sIP - The IP to show the click path for.
' lYear - the numerical year (optional)
' lMonth - the numerical month (optional)
' lDay - the numerical day (optional)
' lHour - the numerical hour (optional)
'
Sub ShowClickPath( sIp, lYear, lMonth, lDay, lHour )
If Len( sIP ) = 0 Then
Response.Write( "Error: IP Address not provided for displaying a Click Path." )
Exit Sub
End If
' sSQL = "SELECT Stats.*, Refs.RefName, Paths.PathName FROM Paths RIGHT JOIN (Refs RIGHT JOIN Stats ON Refs.RefID = Stats.RefID) ON Paths.PathID = Stats.PathID WHERE (((Stats.IP)='"&sIp&"') AND ((Stats.Date)="&sDate&"))"
sSQL = "SELECT Stats.Date, Stats.Time, Stats.IP, Paths.PathName, Refs.RefName FROM Paths RIGHT JOIN (Refs RIGHT JOIN Stats ON Refs.RefID = Stats.RefID) ON Paths.PathID = Stats.PathID Where Stats.IP='" & sIp & "'"
If Len( lYear ) > 0 Then
sSQL = sSQL & " and DatePart(""yyyy"", [Stats].[Date]) = " & lYear
End If
If Len( lMonth ) > 0 Then
sSQL = sSQL & " and DatePart(""m"", [Stats].[Date]) = " & lMonth
End If
If Len( lDay ) > 0 Then
sSQL = sSQL & " and DatePart(""d"", [Stats].[Date]) = " & lDay
End If
If Len( lHour ) > 0 Then
sSQL = sSQL & " and DatePart(""h"", [Stats].[Time]) = " & lHour
End If
' Connect to the database
OpenDB sConnStats
rs.Open sSQL,,,adCmdTable
sFieldName = ""
If bShowLinks And InStr( rs("RefName"), "http://" ) > 0 Then
sFieldName = "<a href=""" & rs("RefName") & """>" & rs("RefName") & "</a>"
Else
sFieldName = rs("RefName")
end if
%>
<table border=0 cellspacing=1 cellpadding=2 bgcolor = "#ffe4b5">
<tr>
<td bgcolor="#ffe4b5" width=10>»</td>
<td colspan=3 class="smallerheader" bgcolor="#ffe4b5">Stats: Click path for <%=sIp%> on <%=rs("Date")%></td>
<td bgcolor="#ffe4b5" width=10></td>
</tr>
<tr>
<td bgcolor="#fffaf0"></td>
<td bgcolor="#fffaf0"><%=rs("Date")%></td>
<td bgcolor="#fffaf0"><%=rs("Time")%></td>
<td bgcolor="#fffaf0"><%=sFieldName%></td>
<td bgcolor="#fffaf0"></td>
</tr>
<%
' Calculate totals
do while not rs.eof
sFieldName = ""
If bShowLinks And InStr( rs("PathName"), "http://" ) > 0 Then
sFieldName = "<a href=""" & rs("PathName") & """>" & rs("PathName") & "</a>"
Else
sFieldName = rs("RefName")
end if
%>
<tr>
<td bgcolor="#fffaf0"></td>
<td bgcolor="#fffaf0"><%=rs("Date")%></td>
<td bgcolor="#fffaf0"><%=rs("Time")%></td>
<td bgcolor="#fffaf0"><%=sFieldName%></td>
<td bgcolor="#fffaf0"></td>
</tr>
<%
rs.movenext
loop
%>
</table>
<%
conn.close
'set rs=nothing
'set conn=nothing
End Sub
Function GetDate
If Len(Request.QueryString("Month")) > 0 Then
GetDate = MonthName(Request.QueryString("Month"))
If Len(Request.QueryString("Day")) > 0 Then
GetDate = GetDate & " " & Request.QueryString("Day")
End If
GetDate = GetDate & ", "
End If
If Len(Request.QueryString("Year")) > 0 Then
GetDate = GetDate & Request.QueryString("Year")
End If
If Len(GetDate) = 0 Then
GetDate = "All Data"
End If
End Function
sIp = Request.QueryString( "IP" )
sYear = Request.QueryString( "Year" )
sMonth = Request.QueryString( "Month" )
sDay = Request.QueryString( "Day" )
sHour = Request.QueryString( "Hour" )
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>StatCounteX 3.1</title>
<link rel="stylesheet" type="text/css" href="scx.css">
</head>
<body>
<table border=0 width="100%">
<td class="title">
StatCounteX 3.1 Reports
</td>
<td class="smallertext" align=right>
<a href="http://www.2enetworx.com/dev/projects/reportbug.asp?pid=4" target="_blank">Report a Bug</a> |
<a href="http://www.2enetworx.com/dev/projects/recommend.asp?pid=4" target="_blank">Recommend a feature</a> |
<a href="http://www.2enetworx.com/dev/projects/question.asp?pid=4" target="_blank">Ask a question</a> |
<a href="http://www.2enetworx.com/dev/projects/submitsite.asp?pid=4" target="_blank">Submit a site</a>
</td>
</table>
» <a href="reports.asp">Reports</a> » <a href="reportpathy.asp">Yearly Report</a>
» <a href="reportpathm.asp?year=<%=sYear%>">Monthly Report</a>
» <a href="reportpathd.asp?year=<%=sYear%>&month=<%=sMo nth%>">Daily Report</a>
<%
If Len( sIp ) > 0 Then
%>
» <a href="ips.asp?year=<%=sYear%>&month=<%=sMonth%>&da y=<%=sDay%>">Visitors Report</a> » Click Path
<%
Else
%>
» Visitors Report
<%
End If
%>
<br><br>
<%
Response.Write( "<b>Displaying Data For " & GetDate & "</b><br><br>" )
If Len( sIp ) > 0 Then
ShowClickPath sIp, sYear, sMonth, sDay, sHour
Else
ListIps sYear, sMonth, sDay, sHour
End If
%>
<a href="<%= Request.ServerVariables("HTTP_REFERER") %>">Back to Previous Page</a>
<table border=0 width="100%">
<tr>
<td class="smallertext">
Visit <a href="http://www.2enetworx.com/dev">2eNetWorX</a> for more OpenSource
VB and ASP Projects.
</td>
<td align="right">
<a href="http://www.2enetworx.com/dev/projects/statcountex.asp">
<img src="29images/nine.jpg" width=90 height=30 alt="StatCounteX" border="0">
</a>
</td>
</tr>
</table>
</body>
</html>
Where is the fault? Is it in this file? What make the other file not run correctly?
I hope you help me with these problems, in order to join succesfuly the mysql community, and make my site work fine again.
Thanks in advance