Most applications talk to a variety of data stores. There has been a considerable evolution in how applications talk to a data store. The most basic API provided by Java EE is JDBC (Java Database Connectivity). JDBC is used to talk to relational databases from the first version of Java EE. JDBC is based on using SQL queries to manipulate data. The following is an example of typical JDBC code:
PreparedStatement st = null;
st = conn.prepareStatement(INSERT_TODO_QUERY);
st.setString(1, bean.getDescription());
st.setBoolean(2, bean.isDone());
st.execute();
Typical JDBC code contains the following:
- The query (or stored procedure) to execute
- The code to set parameters for query into statement objects
- The code to liquidate ResultSet (the result of executing the query) into beans
Typical projects involved thousands of lines of JDBC code....