The JDBC is a pure Java API used to execute SQL statements. It provides a set of classes and interfaces that can be used by developers to write database applications. The steps needed to execute a SQL query using JDBC: 1. Open a connection to the database. 2. Execute a SQL statement. 3. Process th results. 4. Close the connection to the database.
Hi... JDBC: JDBC is a specification which allows the developers to communicating from front end(java) to back end(oracle,sybase...). The standard steps to connecting the database as follows: try{ 1: Loading the drivers Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 2:Getting the connection Connection con=DriverManager.getConnection("jdbc:odbc:datasourcename","scott","tiger"); 3:Create the Statement Statement st=con.createStatement(); 4:Execute the Statement ResultSet rs=st.executeQuery("select * from emp"); 5:Accessing the data from the backend while(rs.next()) System.out.println(rs.getString(1)); System.out.println(rs.getInt(2)); System.out.println(rs.getString(3)); 6:close the connection }catch(SQLException se) { se.printStackTrace(); } finally{ con.close(); rs.close(); st.close(); }