Can not use KILL to kill your own process

kryanker
Member Posts: 14
Hello,
My customer had requested a customization which will auto log off a Navision Idle session if number of user sessions is exceeded from the license allowed. This customization is done on NAV2009 sql server option. I had tried on using a SQL automation ('Microsoft SQLDMO Object Library'.SQLServer) to kill the process from SQL server since deletion of record on Navision Session table is not working. Below is my part of coding on using the automation to kill the process:
I was placed these code in Codeunit 1 ApplicationManagement, and trigger on LogInStart() function. Which I thinking to check session table for the idle session and kill it while login as a new session. The problem is my coding getting a run time error which shown below and the session is not killed.
The following SQL Server error or errors occurred:
6104,"42000",[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot use KILL to kill your own process.
Can anyone advice me on this my idea? Or any suggestion on this auto log off customization?
Thank you.
My customer had requested a customization which will auto log off a Navision Idle session if number of user sessions is exceeded from the license allowed. This customization is done on NAV2009 sql server option. I had tried on using a SQL automation ('Microsoft SQLDMO Object Library'.SQLServer) to kill the process from SQL server since deletion of record on Navision Session table is not working. Below is my part of coding on using the automation to kill the process:
IF NOT ISCLEAR(autoSQL) THEN CLEAR(autoSQL); CREATE(autoSQL); autoSQL.Connect(MYSERVER,MYUSERID,MYPASSWORD); autoSQL.KillProcess(Session."Connection ID"); autoSQL.Close;
I was placed these code in Codeunit 1 ApplicationManagement, and trigger on LogInStart() function. Which I thinking to check session table for the idle session and kill it while login as a new session. The problem is my coding getting a run time error which shown below and the session is not killed.
The following SQL Server error or errors occurred:
6104,"42000",[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot use KILL to kill your own process.
Can anyone advice me on this my idea? Or any suggestion on this auto log off customization?
Thank you.
0
Comments
-
I suggest to use NAS to do that (NAV cApplication Server) which will check the session and kill them if needed.0
-
-
Thanks for the replies, I will try working on yours suggestion.0
-
I was surprised that your code didn't work, so I tried making a simular example which works fine:
Report - OnPreReport() Session.SETRANGE("My Session",TRUE); Session.FINDFIRST; CREATE(SQLServer); SQLServer.LoginSecure := TRUE; SQLServer.Connect('MY-PC'); SQLServer.KillProcess(Session."Connection ID"); SQLServer.DisConnect;
Don't quite see the difference... :-kRegards
Peter0 -
Thanks to all replies again.
Here I continue my topic.
reply to pdj,
Yes, is no difference. But :oops: is my own mistake, I used the automation KillProcess after I delete the session record. So it point back to the own process when I trigger the KillProcess. (that's why it prompt me can not kill myself)
thanks to pdj
#-o but after I had solved this problem, another problem come out. I noticed that delete the record from session table is equal with using automation to kill the process. Do either one will be enough to meet my requirement.but my case difference, normally (is it? :-k ) when user access the NAV screen which already process killed will be prompted an error about the connection. Then user will need to login again to a new session to access NAV.
](*,) I had tried many times of it and the session has "revive" when user access back to the killed session. Is that because of I was using SQL Server 2008 on the server? Or this should not be the correct way to kill the navision SQL session? Or any suggestion how to closed the NAV windows which process get killed?0 -
Hi kryanker,
I'm also having the same problems, i'm using sql server 2008. After the connection of a user is terminated, when that user click it create / revive the session again?
Its weird, is there anything to set to permanently kill that session and force the user to login again?
Thanks______________
Regards,
Steven0 -
I think that this is question of NAV client version. It seems that since som build of NAV 5.00SP1 the connection is re-established when user need it.0
-
Of course if you want the client to disappear you could try this piece of code ...
OBJECT Codeunit 99903 Crash Navision { OBJECT-PROPERTIES { Date=26/08/09; Time=15:39:07; Modified=Yes; Version List=; } PROPERTIES { OnRun=VAR CU@1000000000 : Codeunit 99903; BEGIN CU.RunTask(CU); MESSAGE('Didn''t crash'); END; } CODE { PROCEDURE RunTask@1000000000(VAR Self@1000000000 : Codeunit 99903); BEGIN CLEAR(Self); END; BEGIN END. } }
In truth, it's not something Microsoft is going to find easy to fix.Robert de Bath
TVision Technology Ltd0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 321 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions