In ASP I am using a DNS-less connection (see code below: with the log in credentials filtered).
Testing the connection string and executing the sample query works fine locally but the problem comes when I test the same file on my hosting site's server. It appears that the page is not getting access to the remote database by so doing it returns an error but I am not entirely sure why this is the case.
If anyone has ever come across this problem your input will be greatly appreciated.
Code:
<%
on error resume next
dim csmp_conn
dim adoRS
dim counter
set csmp_conn = Server.CreateObject("ADODB.Connection")
set adoRS = Server.CreateObject("ADODB.Recordset")
csmp_conn.Open "Driver={MySQL ODBC 5.1 Driver}; Server=XXXXX; Database=XXXXX; Uid=XXXXX; Pwd=XXXXX;"
adoRS.ActiveConnection = csmp_conn
response.write "<h2>Number of Records in MyTable: </h2>"
adoRS.Open "SELECT * FROM myTable"
' Count how many records exist
dim iRecordCount
iRecordCount = 0
DO WHILE NOT adoRS.EOF
iRecordCount = iRecordCount + 1
adoRS.MoveNext
Loop
' Display result
Response.Write "Record Count:(" & iRecordCount & ")"
adoRS.Close
Set adoRS = Nothing
%>
If anyone has ever come across this problem your input will be greatly appreciated.
Comment