Monday, August 19, 2013

JDBC

What is difference between Database and DBMS?

Database is a collection of interrelated data. Database Management system is a software which can be use manage the data by sorting it on the database.

How could be executed when we send a query to Database?

Database engine take the following step
  • Query Tokenization
  • Query Passing
  • Query Optimization
  • Query Execution

What is JDBC drivers?

JDBC drivers are processes  of interaction with database and java application.

How many types of JDBC drivers?

There are 
  • JDBC-ODBC Driver
  • Native Driver
  • Middel-ware Driver
  • Pure Java Driver

What is JDBC and what are the step write JDBC application?

The process of interacting with database from a java application is called JDBC.
To interacting with database from java application we use following steps..

  1. Load and register driver
  2. Establish connection between a java application and the database
  3. Prepare either statement object or prepare statement or callable statement object as per the application requirement.
  4. Write and execute sql queries. 
  5. Terminate the connection which we have established.


How to execute SQL Queries from a java application?

To execute the sql queries we will use the following methods from Statement object.

  • st.executeQuery(....)
  • st.executeUpadte(....)
  • st.execute(.....)

What are the difference between executeQuery(), executeUpdate() and execute() methods?

execute() :- When we use selection group sql with the execute() then we will get Resultset object at heap memory with the fetched data.
public boolean execute(String sql Query)
executeUpdate() :-  Where executeUpdate() can be used to execute group of sql query to update the database.
public int executeUpdate(String sql query)
executeQuey():- where executequery() can be used to execute selection group sql queries to fetch the data from database.
public ResultSet executeQuery(sql statement)

What is ment by ResultSet object?

ResultSet is an Object which can be used to maintain the fetched data from database in the JDBC application.

What is result set MetaDeta?

Data about data is called metadata. Similarly data about data available in the result set object  is called Result set Meta Data.


What is prepared statement and when we used ?

Prepared statement retain pre-compile SQL statements.Same optimization query will be used for new parameter value. and it is used in when same query will fire with different value of parameter.


What is Statement ?

Statement is doesn`t retain pre-compile sql statement .query will be optimized & complied object again & again if parameter value are changed.

No comments:

Post a Comment