Is there a way to create a small exe or a program that runs periodically that captures the machine name and the logged in user and updates a SQL database with a join from the logged in user.
Asked
Active
Viewed 183 times
-2
-
1Sure, why not. get coding. – hoss Jul 22 '15 at 18:23
-
thanks hoss for the encouragement. I've looked and found a few examples but they don't seem to work. I'm not that good was hoping for a little guidance. – user5144826 Jul 22 '15 at 18:42
1 Answers
0
Are you talking about getting the username who has logged in the database or with a specific application. For the database you can simply query the V$SESSION and I guess it will suffice your requirements.
Regards
Andy
Sandeep
- 774
- 3
- 8
-
No Andy. I'm looking for the logged in windows user which is the same username for the internal application along with their machine name. Essentially the requirement is to know from which machine the user had logged into the application. We had an ActiveX code which would accomplish this but with the change to html5. This code cannot be executed from chrome – user5144826 Jul 22 '15 at 21:07
-
-
I got it to capture the machine name, the user logged in with the code below. Next step is to open a connection to the database using odbc and running an update command. – user5144826 Jul 22 '15 at 22:24
-
import java.net.UnknownHostException; public class Snippet { public static void main(String[] args) { String username = System.getProperty("user.name"); java.net.InetAddress localMachine = null; try { localMachine = java.net.InetAddress.getLocalHost(); } catch (UnknownHostException e) { e.printStackTrace(); } System.out.println("Hostname of local machine: "+ localMachine.getHostName() + "\n" + "IP Address of Logged in User: " + localMachine.getHostAddress() ); System.out.println("Logged in Windows User: " + System.getProperty("user.name")); } } – user5144826 Jul 22 '15 at 22:24