?
Solved

Test Remote Database Connections

Posted on 2011-09-28
5
Medium Priority
?
247 Views
Last Modified: 2012-05-12
Hello,

Is it possible to test a connection string to a remote database and return a True / False if the connection was successful?

If so, any articles / code snippets would be much appreciated.

Thanks,


D.
0
Comment
Question by:NewFourWalls
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
pateljitu earned 2000 total points
ID: 36719055
Try this code, in connection string replace server= with correct IP address of remote server:

<%
on error resume next

dim strConn : strConn = "Provider=SQLOLEDB; Server=192.168.0.100; Database=DBNAME; User ID=UNAME; Password=PWD;"
set conn = Server.CreateObject("ADODB.Connection")
conn.Open(strConn)


if(conn.State = 1) then
    Response.Write("Connection successful <br>")
else
    Response.Write("Connection failed, "& err.Description &" <br>")
end if    
On Error Goto 0
%>
0
 

Author Comment

by:NewFourWalls
ID: 36813734
Hi, thanks for that, however it is extremely slow.

I have users who have 2 - 10 remote database connections, i tested it with 2 and it took 30-45 seconds to return a response.

Is there any way i could speed it up and these functions will run quite often.

Thanks,


D.
0
 
LVL 15

Expert Comment

by:pateljitu
ID: 36816136
Based on your post I am judging that all SQL server instances are running at different location and have a public facing IP address, ASP page that is accessing SQL server is on another server, if that's the case I would say yes the processing time will be a bit more and just using classic asp we cannot speed up the process.

Another idea would be create a web service that would sit on each SQL server that check the SQL connectivity and output TRUE or FLASE as return value and in your ASP page access the web service and retrieve the value (which would be much more faster for sure)

Good Luck.
0
 

Author Comment

by:NewFourWalls
ID: 36816426
Hi Pateljitu,

Thank you for your help. Unfortunately it's not really possible to use the webservice option but at least I now know there is no viable option in ASP.

Thank you.


D.
0
 

Author Closing Comment

by:NewFourWalls
ID: 36816428
Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question