In the connection first task of this programmer is to load database driver.
String driver = "oracle.jdbc.driver.OracleDriver";
The next task is to make a connection.
When url is passed into getConnection() method of DriverManager class it returns connection object.
Executing Query or Accessing data from database:
This is done using following code :-
stmt=con.createStatement(); //create a Statement object
rst=stmt.executeQuery("select * from books_details");