The JDBC is used whenever a Java application should communicate with a relational database for which a JDBC driver exists. JDBC is part of the Java platform standard; all visible classes and interfaces used in the JDBC are placed in package Java
Main JDBC classes:
Download the Java connecting with Oracle Code, you have to oracle jdbc driver jar file in your project library reference or in your classpath so that you compiler can find the oracle jdbc jar file….
MyOracle.java oracle-java-jdbc-driver.jar
- DriverManager. Manages a list of database drivers. Matches connection requests from the java application with the proper database driver using communication subprotocol. The first driver that recognizes a certain subprotocol under jdbc will be used to establish a database Connection.
- Driver. The database communications link, handling all communication with the database. Normally, once the driver is loaded, the developer need not call it explicitly.
- Connection. Interface with all methods for contacting a database
- Statement. Encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.
- ResultSet. The answer/result from a statement. A ResultSet is a 2D list which encapsulates all outgoing results from a given SQL query.