You are here:   Home
Register   |  Login

Captured Technology - Blog

Minimize

Testing a SQL Server Connection on a Remote Server

Jan 2

Written by:
1/2/2009 11:18 AM  RssIcon

If you are establishing a web server or an application server and need to test the database connectivity from the new server back to the database server, writing a quick visual basic script that produces the feedback needed is an easy solution. Below is the code from a vbs file with the connection information left out. Just complete the connection information and run the script from the new remote server.

dim local_connection
msgbox (db_connect(local_connection, "Provider=sqloledb;" & _ 
    "Data Source=myServerName;" & _ 
    "Initial Catalog=myDatabaseName;" & _ 
    "User Id=myUsername;" & _ 
    "Password=myPassword"))

Function db_connect( byRef curSession, connection_string)

    dim connection

    on error resume next
    ' Opening connection
    set connection = CreateObject("ADODB.Connection")

    If Err.Number <> 0 then
       db_connect= "Error # " & CStr(Err.Number) & " " & Err.Description
        err.clear
        Exit Function
    End If
  
    connection.Open connection_string
    If Err.Number <> 0 then
        db_connect= "Error # " & CStr(Err.Number) & " " & Err.Description
        err.clear
        Exit Function
    End If

    set curSession=connection
    db_connect=0

End Function

Tags:
Categories:

1 comment(s) so far...


Gravatar

Re: Testing a SQL Server Connection on a Remote Server

This is very good topic which has most informative information on SQL server connection used in all data bases.I really get informative information from your blog.

By web designer oman on   6/6/2011 4:14 AM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment   Cancel 

FaceBook

Minimize

Mobile Version

Minimize
Add CapturedTech - Technology Mippin widget

Translate

Minimize

Sponsors

Minimize
Promotional Banner- Free Shipping on New and Used Books- Red- 120 x 600

Recent Comments

Minimize
Re: Three Benefits to Using a Royalty-Free Image on Your Website or Blog
I also prefer to use royalty-free images. They give more credibility in your site or blog posts.
Re: Websites vs. Facebook Pages (Infographic)
Internet can be very useful for small business to market them self, there is always some free way to reach your audience via Internet.
Re: Is Keyword Density Still Important For On Page SEO
The search engines hadn’t quite caught up yet. As a result, it wasn’t uncommon to see sites rank highly when their content read something like this.that they follow SEO best practices than you will by trying to figure out a way to get your keywords into your page content another one or two times.
Re: Websites vs. Facebook Pages (Infographic)
Very interesting topic, infographics was a new concept for me, will definitely use it.
Re: Reducing Small Business Blues
Running a business is tough and you are right, most of the time you are the core aspect of each area of a business. I don't think I could handle doing my own accounting, like you I am too terrible with numbers!

u comment, i follow