1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)

JDBC Tutorials

What are Statement , PreparedStatement and CallableStatement ?

Statement : Statement every time compile the SQL and Execute.

Example: String sql="select * from emp where emp_id = 1";

Statement stmt = conn.createStatement(sql);



PreparedStatement :

If we are using PreparedStatement the execution time will be less. First time RDBMS comiple the SQL and PreparedStatement is executed then other calls doesn't compile the SQL only execute the SQL within the connection live.



you must use a PreparedStatement object if you want to use large objects like BLOBs or CLOBs.



PreparedStatement is its support for batching



Example :

String sql="select * from emp where emp_id = ?";

PreparedStatement pStmt = conn.prepareStatement(sql);

pStmt.setLong(1, profile.getUserId());



CallableStatement :CallableStatement is for call to a stored procedure.

Example :

CallableStatement cs =

con.prepareCall("{call SHOW_CUSTOMER}");

ResultSet rs = cs.executeQuery();

Reviews and Comments


PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2016


About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy