Beruflich Dokumente
Kultur Dokumente
RemoteAccessOfTheDatabaseUsingSQL
Server
ByHumzaTufailonJun14,2016
Inthisarticle,youwilllearnaboutremoteaccessofthedatabaseusingSQL
Server.
2.3 k 11 0
Download100%FREESpireOfficeAPIs
Introduction
Thedatabaseisthemostfundamentalpartoftheapplication.Withoutthedatabase,there
isnopresenceoftheapplication.Mostrealworldapplicationscontaindatabasessuchas
thoseusedbyhospitals,businesses,andthepublicandcorporatesectors.Theissuethat
wewanttoaddressisthatthedatabaseconcurrentlyusesthesekindsofapplications.
LetssaywetaketheexampleoftheTrainReservationSystemifweinstallthe
databasetothespecificstationthenweareunabletopickthecompletescheduleofthe
trainsontheotherstations,soweneedtoinstallthedatabaseontheseparatemachine
andaccessitremotely.
Myarticleisabouthowtoaccessthedatabaseremotely.
Ifwewanttoaccessthedatabaseremotely,thenmakesureyouselecttheSQL
ServerBrowseragentduringinstallation.
Step1
OpentheSQLServerManagementStudioandlogintothedatabase,usingtheSQL
Server/Windowsauthentication.
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 1/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
Step2
Afterlogin,gototheObjectExplorerandrightclickontherootdirectory,inmycase
namedHUMZA(SQLServerversa)andclickthePropertiesandthiswindowwillopen.
ClicktheconnectionsandmakesurethefollowingcheckboxisChecked:
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 2/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
Step3
Start>Run>SQLServerManager(version).msclike.
Start>Run>SQLServerManager10.msc.
ForSQL2005,youcanuseSQLServerManager.msc.
JustlookunderC:\Windows\System32\SQLserverConfigurationManager.
MakesureallSQLserverservicesarerunning.
ClickSQLServernetworkconfiguration,expanditandclickProtocolsfor
MSSQLserver.
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 3/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
WeseethethreeoptionsontherighthandpanethatarelistedasSharedMemory
WhichisEnabledbydefault,namedPipes,whichisDisabledbydefault,andthe
lastonewhichisimportantisTCP/IP,whichisbydefault,andthatisenabledin
thelatestSQLServerversionsandifitisnotenabled,thenrightclickProperties.
RightclickonTCP/IPandclickenabled(incaseit'sdisabled)againandrightclick
propertiesandweseeitjustlikethiswindow:
GotoIPaddressestab.
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 4/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
ScrolldownandmakesurethattheAllIPandportaresetto1433,whichisthe
defaultportandwecanchoosealltheotherportsnotreservedbythesystemalso.
ClickOK,gobacktoSQLServerservicesandrestartalltheSQLServerservices.
Step4
GotoWindowsfirewallasIhaveWindows10inmycase.
ControlPanel\AllControlPanelItems\WindowsFirewall.
ClickAdvancedSetting.
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 5/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
ClickInBoundedRulesandclickNewRule
Selecttheportandclicknext.
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 6/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
SelectTCPradioandselectthespecifiedportandgivethenameoftheport,which
is1433inmycase.Youcansetanyportwhichisnotreservedbythesystem.
Clicknextactiontabbutdontchangeanything.Usethedefaultandclicknextin
theprofile.Makesure,weselectallthecheckboxesandthenclicknext.Give
identitytoitbynamingitandclickfinish.
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 7/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
Again,clickonthenewruleandselectthePortradioclick,nextclicktheUDP
radio,clickthespecifiedportandassign1434,whichisthedefaultportforUDPin
SQLServer.ClicknextinActionpanebutdontchangeanything.Clicknextin
profiletabandmakesureallthecheckboxesarecheckedandclicknexttogiveit
totheSQLServerUDPportandclickfinish.
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 8/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
Again,clickonthenewruleatthattimeandselecttheprogramfollowedbyclicking
next.
Givethecompleteprogrampath,whereweaddtheSQLbrowser.exe,whichis
locatedatthatpathinmycase.
C:\ProgramFiles(x86)\MicrosoftSQLServer\90\Shared
Clicknextbutdontchangeanything.Clicknexttomakesureallthecheckboxes
arecheckedandthenclicknexttoassignthenameSQLserverbrowseragent
andclickfinish.
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 9/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
Again,clickthenewruleandselecttheprogram.Thistime,weaddthe
SQLsrvr.exe,whichislocatedatC:\ProgramFiles\MicrosoftSQL
Server\MSSQL12.MSSQLSERVER\MSSQL\Bin
Clicknextbutdontchangeanything,followedbyclickingnexttomakesureyou
havecheckedallthecheckboxesontheProfiletab.
Clicknext,nameitSQLserverexeandclickfinish.
Makesureyouhave4newrulesinthefirewall.
Youworkisdone.SettheportenabledtotheTCP/IPprotocolstotheServerand
add2ports1433TCpand1434UDPand2programsSQLbrowser.exeand
SQLsrvr.exe.
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 10/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
Step5
Fortheportweusethecanyouseeme.org.ThisWebdetectstheIPtoautoenter
theport1433.
Itgivesanerrorbecauseitisunabletolistentoport1433ontherespectiveIDand
weknowhowtoresolveit.
InPakistan/restoftheworld,manyISPprovidetheinternetfacilitybuttheissueis
thattheydontassigntheStaticipaddressoneveryrestartoftherouter,asthese
ISPprovidesdifferentIPaddresses,whichisannoyingmostofthetime.
ItisthePTCL(PakistanTelecommunicationCompanyLtd)thatprovidesthestatic
iP500permonth.
WecanchecktheISPstaticipservices,accordingtothecountrywhichprovides
thecheaprates(ifforproductionpurposes)buthere,Idemonstratedhowtoaccess
remotedatabases.
Gotoroutersettings.Inmycase,IhavePTCLrouter.Hit192.168.1.1and
192.168.1.Xandincaseofanyotherbrandsofroutersuserneedstopassand
clickOK.
FindOuttheNATservicesandinmycase:
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 11/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
Clickaddandthenundercustomservices,itgivesthenamelikeSQLServerTCP.
OpenruntypeCMDandenteripconfig.NotetheIPaddress
WecanaddUDP,whichfollowsthesameprocedure.
AfteraddingNAT,weagainopenthecanyouseeme.organdchecktheportatthe
timewelistenedtoport1433.
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 12/13
23/08/2016 RemoteAccessOfTheDatabaseUsingSQLServer
Withallthestepsshownnow,weareabletologinsuccessfully.
Theconnectionstringformatwillbe:IPAddress/InstanceName,PortNumber
Inmycase,itis182.185.184.158\MSSQLSERVER,1433
MakesuretologinwithSQLServerauthentication.
ClickConnect,tologinsuccessfully.
http://www.csharpcorner.com/article/remoteaccessofthedatabaseusingsqlserver/ 13/13