This post shows how to do JDBC [Java Database Connectivity] in Java. It was long time pending but today only I could recall it of posting it. My Apologies for it.
STEP 1: Download ojdbc14.jar file from http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html
STEP 2: Add ojdbc14.jar to the build path of your project.
STEP 3: Create a Java Program JDBCConnectDemo.java like following
In above program,
URL= Connection String including HOSTNAME, PORT NO, SID.
DRIVER = Name of the driver used.
In above case OracleDriver is used. You can connect to any other driver also in similar way.
Username = username used to connect to the database
Password = password used to connect to the database
STEP 4: Output like following will be shown when above program will be run

