Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Test Remote Database Connections

Posted on 2011-09-28
5
Medium Priority
?
249 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

618 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