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:
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.
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
viewtopic.php?f=5&t=31486
Peter
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?
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,
Steven
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
TVision Technology Ltd