Data Persistency using JDBC

Data Persistency using JDBC

JDBC is a step by step process or a technology or an API or the collection of predefined classes and interfaces or an abstraction, it will provide very good environment to interact with database from java applications in order to perform database operations from java applications.

To prepare JDBC applications we have to use the following steps.

Load and Register Driver


Establish Connection between Java application and Database.

Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "ashok");

Create either Statement or PreparedStatement or CallableStatement as per the requirement.

Statement st = con.createStatement();

Write and execute SQL Queries.

ResultSet rs = st.executeQuery("select * from employee");

Close the resources.

  • In Jdbc Applications, when we establish Connection between java application and database , automatically, the generated Connection will be available in “Auto-Commit” mode, in this mode, if we submit an SQL query to the Connection then Connection will carry that SQL query to Database Engine and Connection will make Database Engine to execute SQL Query and to results in Database Permanently, this Nature of Connection is able to achieve Data Persistency in JDBC Applications.
  • In JDBC applications, we have provide SQL Queries explicitly to perform database operations, So that, Developers must required SQL Awareness.
  • In JDBC applications, developers must have explicitly concentration on Driver Management, Connection Management and Statement Management.
  • In JDBC Applications, the steps like Load and Register Driver, Establish Connection, Create Statement and Close resources etc. are common ion every JDBC Application, we must write repeatedly, it will increase Code duplication.
  • In Jdbc applications, we have to hard code the JDBC Parameters like Driver class name, Driver URL, Database User Name and Database password etc
  • In JDBC, Transactions support is not good.
  • In JDBC almost all the exceptions are checked exceptions, we must handle them by providing JAVA code.
  • In JDBC applications, if we retrieve data from database then that will be stored in ResultSet object at java applications, it is not implementing interface and which is not eligible to carry in network.
Data Persistency using JDBC
Scroll to top