By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,659 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,659 IT Pros & Developers. It's quick & easy.

Connect Remote ASP to Remote MySQL

P: 3
In ASP I am using a DNS-less connection (see code below: with the log in credentials filtered).

Expand|Select|Wrap|Line Numbers
  1. <%
  2. on error resume next
  3.  
  4. dim csmp_conn
  5. dim adoRS
  6. dim counter
  7.  
  8. set csmp_conn = Server.CreateObject("ADODB.Connection")
  9. set adoRS = Server.CreateObject("ADODB.Recordset")
  10. csmp_conn.Open "Driver={MySQL ODBC 5.1 Driver}; Server=XXXXX; Database=XXXXX; Uid=XXXXX; Pwd=XXXXX;"
  11.  
  12. adoRS.ActiveConnection = csmp_conn
  13.  
  14.  
  15. response.write "<h2>Number of Records in MyTable: </h2>"
  16. adoRS.Open "SELECT * FROM myTable"
  17.  
  18. ' Count how many records exist
  19. dim iRecordCount
  20. iRecordCount = 0
  21. DO WHILE NOT adoRS.EOF
  22. iRecordCount = iRecordCount + 1
  23. adoRS.MoveNext
  24. Loop
  25.  
  26. ' Display result
  27. Response.Write "Record Count:(" & iRecordCount & ")"
  28.  
  29. adoRS.Close
  30. Set adoRS = Nothing     
  31.  
  32. %>
  33.  
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.
Jan 23 '12 #1
Share this Question
Share on Google+
2 Replies


100+
P: 144
What is the error message? Or does it just crash?
Jan 23 '12 #2

P: 3
Hi sorry for the late response. I managed to find a solution to the problem. It was more of a system issue than the code itself.
Jan 27 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.