Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Kill Network Connection

Status
Not open for further replies.

TariqMehmod

Programmer
Mar 4, 2004
100
PK
Respected Sir,

There are 3 clients attached with Server and network connection is shown like this

zz_ql2ruo.png


I want to disconnect all clients by Disabling network connection.
Is it possible with VFP codes?
Or is there any other method to disconnect clients from Sqlserver database.

Please
 
Sir my specific need is to Disable Network Connection with VFP Codes.
I want to disable network connection only on Server not on clients.
 
You said: "Or is there any other method to disconnect clients from Sqlserver database."

If you want to disconnect clients from SQL Server, don't disable the network, even if this server only runs SQL Server and no other service for clients, you likely will have a file share there sooner or later, too, or other things. You usually never completely disconnect a server from the network unless you want to replace it completely.

To disconnect all users there are several solutions per database, but the obviously simplest would be stopping the SQL Server service.

On the server you need a cmd script doing
Code:
net stop servicename

Where servicename needs to be the servicename for SQL Server, that can vary with versions, get an overview simply in the taskmanager.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Code:
RUN net stop service

This is an administrative task and you will not be able to run this from a client anyway, it has to stop the service on the server so it has to run there.
It wouldn't make sense to compile this into an EXE you put on the server, when you start it from a client it will still not run on the server, you need to have a way of acting on the server itself and you wouldn't install VP runtimes or your app there, you would let an admin do that.

Just like with the network this is something that wouldn't be advisable anyway if the SQL Server also has other databases for other applications you don't want to interrupt the whole server as hardware nor as SQL Server.

What do you plan to do? If you want to alter the database, you can do that without exclusive single user access, Backup? Same.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Thank you, Mike.

Yes, I edited my post. It won't help anyway, as said. To run something serverside you would at least not integrate it into the application you run clientside.

I'll see what Tariq actually wants to do. For different goals there are different solutions, eg you can establish an SQL Server Job to do a backup.

Bye, Olaf.



Olaf Doschke Software Engineering
 
It's certainly an odd idea to kill a network connection - particularly on a server you are probably talking to via RDP

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Sir What service should I STOP to make network adapter disable?

A_ywc9gt.png


While sitting on Server, I want to click Disable with VFP

b_lbrayn.png


Please
 
No, Disabling Ethernet & Wi-Fi is not done by stopping services. I was talking about SQL Server.

You sit on the server and you really just want to replace the need to make four clicks with one click?

Bye, Olaf.

Olaf Doschke Software Engineering
 
Sir Olaf Doschke
You mean I must stop SQLSERVICES instead of disabling networking connection to clients?
 
Dear TariqMemhmod.

Actually, the clean solution is to let clients close their connections with SQLDisconnect(). Whenever you'd cut off a server via disabling the network adapter or stopping the SQL Server service or disconnect just the connections to a specific database when putting it offline or in single-user mode, that is a disruption. Applications will throw errors when you do that, users end up with unsaved changes, not able to end tasks if you do that during business hours.

Be assured, I don't assume you'd do, you'd likely want to do all that after hours. But in today's world, admins don't sit at servers themselves to maintain them, not on the software level, you set them up for remote handling and then you obviously never diable adapters.

And as I already said you also don't need to disconnect users to do almost any task on SQL Server, including backups and database updates. I don't even know why anybody would want to do that aside from retiring a server. Or for hardware maintenance. And then you can even make it simpler to yourself, shut down the server. Do your hardware maintenance and turn it on again. Or if there is software maintenance you can only do offline. Then simply turn off the Wi-Fi router, remove cables and turn the server on, you'll be able to work on whatever and eventually turn it off again, bring back the ethernet cabling or Wi-Fi or both finally bring back the server.

So far I could only think you want this features to be embedded in your client-side application, but once you want to do administrative things, there are already all kinds of Windows out-of-the-box solutions, even if you want to automate some things done in one go, write Powershell or batch scripts for that, don't write an admin VFP EXE or PRG. If you're doing admin work and want to automate it, that's the domain of batch scripts and not VFP and I bet you find ready to use solutions in forums about server administration. Don't use VFP as your admin tool for tasks not about VFP.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top