jdbc网络断开-检测网络连接状态

public static void main(String[] args) {   
        URL url = null;   
        try {   
            url = new URL("http://baidu.com");   
            try {   
                InputStream in = url.openStream();   
                in.close();   
                System.out.println("网络连接正常!");   
            } catch (IOException e) {   
                System.out.println("网络连接失败!");   
            }   
        } catch (MalformedURLException e) {   
            e.printStackTrace();   
        }   
    }  

你可能感兴趣的:(jdbc)