In Java, CallableStatement interface is used to execute SQL stored procedures. For executing stored procedures, we first call the prepareCall() method of Connection object. We need to pass the procedure name and parameter information to the prepareCall() method. This method returns a CallableStatement object for calling database stored procedures. Calling stored procedure in Java …
Continue reading Calling Stored Procedure in Java using CallableStatementJDBC
In this article, we will discuss about Updatable ResultSets using examples and understand how it is different from a normal ResultSet. Updatable ResultSet Normal read-only ResultSet allows you only to read the data. An updatable ResultSet allows you both to read the data and to modify it through the ResultSet. We can get …
Continue reading JDBC Updatable ResultSetIn this article, we will discuss about Scrollable ResultSet in java. Scrollable ResultSet Normal ResultSet allows fetching elements in forward only direction. However, Scrollable ResultSet allows us to easily move in forward/backward direction. To create scrollable ResultSet, we must use a Statement/PreparedStatement object and provide scroll type to createStatement/prepareStatement method. Syntax : …
Continue reading JDBC Scrollable ResultSetIn this article, we will discuss about executing SQL statements using PreparedStatement. PreparedStatement PreparedStatement class is a subclass of Statement class. But, in many situations its favored over Statement because: – In some situations, it is more efficient compared to Statement – It can prevent SQL injection attack – It …
Continue reading PreparedStatement in java
Statement vs PreparedStatement PreparedStatement is a subclass of Statement. Similar to Statements, we can use a PreparedStatement to run SQL statements against database. Here are the differences between them : Efficiency When a statement is executed, the JDBC driver compiles the SQL statement before sending it to database. If …
Continue reading Statement vs PreparedStatement in java