1.

Explain the necessary steps to connect to the database in Java?

Answer»
  • IMPORT JDBC packages and then load in any of the FOLLOWING WAYS- Class.forName(), DriverManager.registerDriver(). Then register JDBC driver
  • Open the connection to the database Connection con= DriverManager.getConnection (url, user, password)
  • To PERFORM a query, create a statement object Statement st= con.createStatement ();
  • Implement the statement object and then RETURN the query resultset. After that process it.
  • Close the resultset, statement objects, and the connection Con.close();


Discussion

No Comment Found