Click here to Skip to main content
15,867,308 members
Articles / Programming Languages / SQL
Tip/Trick

How to connect / access remote SQL Server 2005 database via CC Proxy

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
30 Sep 2011CPOL3 min read 41.1K   7   5
How to connect / access remote SQL Server 2005 database via CC Proxy
Most of the organizations use proxy server shared internet connection for their internal network. Browsing websites via proxy server requires few settings in browser itself where we set proxy server IP and port to 8080 which is default port, doing so is enough for any 1 to surf internet. But as an SQL server database programmers/developers use SQL server management studio to connect to remote database from their client computers. The problem arises when a developer tries to connect a remote database server through SQL server management studio but CC proxy won’t allow connecting to database directly even if developer uses all details correctly.

Why is SQL server management studio not able to connect a remote database via CC proxy?

A very basic thing about proxy server is that all client computers must have to pass all requests to proxy server IP, requests may be from internet browser Or FTP client Or even if its SQL server management studio.
So now if we try to connect a database with original details, the proxy server (say proxy server IP is : 48.152.16.36 ) will not allow connecting to database using original Host name.
Because proxy cannot process any request directly, it must come to Proxy server IP first which is 48.152.16.36 (this is a dummy IP, I have used).

How to solve the problem:

The solution is simple; we just have to follow 2 steps as described below. Here we will be configuring CC proxy, SQL server management studio & SQL server configuration manager.

Step 1: Client side settings

Say for example, we have the following database server details:

CSS
Server name : hostname

Login ID : username

Password : password

Port : 1433 [ SQL server uses 1433 port by default, in case if its different then we have to do settings in CC proxy accordingly ]


Traditionally, we use the above given details directly to connect, if we connect from SSMS (SQL server management studio), it will take the user to the screen as shown below:



Now in the above screen, if we use Server name:
hostname then proxy will not process the request and SSMS will fail to connect to database server.

So rather than providing Server name:
hostname we have to set CC Proxy’s server IP which is 48.152.16.36. But only this much will not work, because we also need to request CC proxy to a specific port which is not used anywhere else in proxy server. So we will use any port, say we use PORT: 1444 instead 1433 which is default port in SQL server.

So now in the above screen, we have to set [Server name: 48.152.16.36, 1444] by keeping userID password as it is.

Ok so we are now done with client side settings. But this much will also not work as we have to do few port map settings in CC proxy on server as well.

Step 2: Proxy server side settings

Setting up the above step 1 setting in client machine will now request proxy server with the port 1444. So we have to define a PORT MAP setting in CC proxy forport: 1444.

Below are the steps to follow for port map settings:

Open CC proxy 6.0
Go to OPTIONS
Click on port map, it will take you to the screen as shown below



In the above screen, set the following:

SQL
Dest Host : hostname

Port type : TCP

Local Port : 1444

Dest Port : 1433

Save all the above details, and we are done.

After this step, all client machines must have to connect to database server using Proxy server IP only with a specific port (in our case it is 1444, however we can use any port but it should not be used anywhere else in the proxy server).

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Gateway Technolabs Pvt. Ltd
India India
Having 4+ years of Technical Experience in asp.net,c#.net, SQL Server 2008,AJAX, XML,JQuery, JavaScript, .net framework, WCF, WPF/Silverlight,SSIS, SSRS, asp.net MVC.

While not working loves Photography and bike riding. Playing computer games are the best stress buster for him Smile | :)

Comments and Discussions

 
QuestionCC proxy Pin
Member 976371319-Dec-13 4:55
Member 976371319-Dec-13 4:55 
Hi Kiran,

I have a PC which is having dedicated connection to my SQL production server.
No other pc has this connection in my LAN. But when I am trying to use CC proxy to allow other PC to use my SQL Connection to connect to SQL production server it is not working.
Kindly help.
GeneralReason for my vote of 5 thanks Pin
magicpapacy7-Oct-11 17:19
magicpapacy7-Oct-11 17:19 
GeneralRe: welcome... thanks for ur vote :) Pin
kiran dangar7-Oct-11 17:42
kiran dangar7-Oct-11 17:42 
QuestionUseful Pin
JQuery Geeks21-Oct-11 19:12
JQuery Geeks21-Oct-11 19:12 
AnswerRe: Useful Pin
kiran dangar21-Oct-11 19:13
kiran dangar21-Oct-11 19:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.