Java URL openConnection() MethodThe openConnection() method of URL class opens the connection to specified URL and URLConnection instance that represents a connection to the remote object referred by the URL. It should be noted that a URLConnection instance does not establish the actual network connection on the creation. This will happen only when calling URLConnection.connect(). SignatureThe openConnection method is overloaded as given in the following table.
ReturnsThe URLConnection linking to the URL. ThrowIOException - if an I/O exception occurs. Example 1Test it NowOutput: The mime type is : text/html; charset=iso-8859-1 The time out time of connection is : 0 Example 2Test it NowOutput: ----------------------------------- <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>JDBC Tutorial | What is Java Database Connectivity(JDBC) - javatpoint</title><link rel="SHORTCUT ICON" href="/images/logo/icon.png" /> <link rel="stylesheet" type="text/css" href="/link.css"/> <meta name="keywords" content="java, jdbc, tutorial, api, drivers, odbc"/><meta name="description" content="Java JDBC Tutorial or What is Java Database Connectivity(JDBC) with examples on Driver, DriverManager, Connection, Statement, ResultSet, PreparedStatement, CallableStatement, ResultSetMetaData, DatabaseMetaData, RowSet, Store Image, Fetch Image, Store file, Fetch file etc."/><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><link rel="canonical" href="https://www.javatpoint.com/java-jdbc" /> Next TopicJava URL Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India