June 2018
Intermediate to advanced
408 pages
11h 23m
English
The following illustrates the problems that we have to face when we work with the core JDBC API:
String query = "SELECT COUNT(*) FROM ACCOUNT"; try (Connection conn = dataSource.getConnection(); Statement statement = conn.createStatement(); ResultSet rsltSet = statement.executeQuery(query)) { if(rsltSet.next()){ int count = rsltSet.getInt(1); System.out.println("count : " + count); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
In the preceding example, I have highlighted some code. Only the code in bold format is important; the rest is plumbing code. So, we have to write that redundant code every time, to perform a database operation.
Let's see some other problems with ...
Read now
Unlock full access