Link to home
Start Free TrialLog in
Avatar of glynco
glynco

asked on

How can I display the IP address of current MySql connections connected?

How can I display the IP address of current MySql connections connected?
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of glynco
glynco

ASKER

Something like this will work?
Process p = Runtime.getRuntime().exec netstat;
System.out.println(p);

Open in new window

Check out http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

and the help for netstat on your platform
Avatar of glynco

ASKER

Tested but It is not showing the IPs.

import javax.swing.*;
 
public class NewClass
{
    public static void main(String args[])
    {
       
try
{
 
//Runtime.getRuntime().exec("netstat");
Process p = Runtime.getRuntime().exec("netstat");
JOptionPane.showMessageDialog(null, p);
//System.out.println(p);
}
catch(Exception e) {
System.out.println("Error creating the FileInfo panel: " +
e);
e.printStackTrace();
}
}
}

Open in new window

You won't get the right output like that. Look at the command and its options and how to capture its output stream which is covered at the link i posted
Avatar of glynco

ASKER

I also need to run continuous beep() if there is access to MySql.
:-)