What are the three statements in JDBC & differences between them


Answered by Jey on 2005-05-10 05:53:50: 1.Statement which is used to run simple sql statements like select and update 
2. PrepareStatment is used to run Pre compiled sql.  
3. CallableStatement is used to execute the stored procedures.

Showing Answers 1 - 14 of 14 Answers

Jey

  • May 10th, 2005
 

1.Statement which is used to run simple sql statements like select and update 
2. PrepareStatment is used to run Pre compiled sql.  
3. CallableStatement is used to execute the stored procedures.

  Was this answer useful?  Yes

vinod

  • Jul 15th, 2005
 

There r three types of statements 
1. Statement 
calls select statements 
2. Prepared Statement 
calls precompiled statements 
3. Callable Statement  
used to call stored procudires

  Was this answer useful?  Yes

vamshi

  • Aug 26th, 2005
 

What does class,forname means in class.forname();

  Was this answer useful?  Yes

Sivakumar

  • Sep 29th, 2005
 

Statement which creates individual query plane for each query that executed but Preparestament only ones create quey plane and resuse same plane for the query executed

  Was this answer useful?  Yes

prasad

  • Sep 30th, 2005
 

1)simple Statement: in advance we should know the inputs for the sql query.Executes simple sql queries.  2)PreparedStatement: we can dynamically pass inputs to the sql query at run time.The prpared statement is compiled only once even though it is used "n" number of times 3) CallableStatement is used to call procedures from thye database

Statement is a Simple Query ,Statement is Send to the Server to complete the QueryPrepare Statement is a PreCompiled Statement suppose a table to require 1000 times a insert same statement,we go for a prepare statment,prepare statement take value at run time called as a place holders(?,?,?,?,?).callable statements are the type of statements used to call the stored procedure means a method,already the methods are stored in the database just like we are calling the methods in a java,simillarly we pass the parameters to the callable statements,it require the vendor specific programming.

  Was this answer useful?  Yes

G.VenkataSuresh

  • Oct 4th, 2005
 

Statements are 3 types.

1. statment 2. prepared Statement   3.Calable statements.

statment is used to excute single SQl statement.here useing createStatement() method.

prepared statement is used to execte sql staements over and over.here useing preparedStatement() method.

calable statement is used to execute multiple sql statements over and over.here useing prepare call() method.

  Was this answer useful?  Yes

Guest

  • Oct 23rd, 2005
 

The SQL Statements are used to send statements to the Database.There are three types of Statements(i) Statement(ii) PreparedStatement(iii) CallableStatementThe Statement Object is used when u want tos end static statements to the database. Static Statements are those that donot containany IN or OUT parameters. Static Statements are Insert, update. Queries.The PreparedStatement is used when u want to send a statement to get executed many times. The advantage of this PreparedStatement is that when ever this PreparedStatement is sent to the DBMS it parses the statement and creates an execution plan or e-plan, so next time when u send the same statement this plan is reused. Prepared Statements are also called Precompiled Statements. Prepared Statemenst can de sent along with the Parameters or can be sent without parameters and these parameters are set by using setxxx().The CallableStatement is used to invoke Stored Procedures. An stored Procedure is a set of SQL statements. Stored Procedure is a piece of code that is stored along with the data base at the server side, hence are faster in performance. This statements make maintaenance easier because if chnages are required they can be done at a single place.

ravikumar s.e ,sit

  • Aug 8th, 2006
 

in class.forName

Class is the wrapper class which is going to use forName to load the driver

code is

Class.forName("oracle.jdbc.driver.OracleDriver");

What will Class.forName do while loading drivers? It is used to create an instance of a driver and register it with the
DriverManager. When you have loaded a driver, it is available for making a connection with a DBMS.

  Was this answer useful?  Yes

Maneswari

  • Mar 30th, 2007
 

Load the driver class using class.forName(driverclass) and class.forName() loads the driver class and passes the control to DriverManager class

  Was this answer useful?  Yes

Three different statements (interfaces) are :--
(a) Statement (b) PreparedStatement (c) CallableStatement

Now CallableStatement is used to execute database objects whch reside on database side e.g procedures

For Statement and PreparedStatement, whatever operations you want to perform via PreparedStatement, you can do the same via Statement as well, the only difference is that the ones executed via PreparedStatement have their execution plan saved in Oracle (database) so if you want to repeat the same operation over and over again, then go for PreparedStatement as it would improve the performance.

Thanks,
Vinay

  Was this answer useful?  Yes

three statements in jdbc
1. statement : whic is used to execute select and non select queries.
2. PreapreStatement : which is also used to execute select and non select queries but PrepareStatement which improves performance of a query by using bind variables concept in sql
CollabaleStatement: which is used to execute Stored procedures in sql.
 CollabaleStatement reduces interaction with Database server

  Was this answer useful?  Yes

Naveen Sharma

  • Jul 31st, 2011
 

class.forname is used to load a class.
When we are making database connectivity then class.forname(................) must be the first statement.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions