Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is jdbc?

Answers were Sorted based on User's Feedback



what is jdbc?..

Answer / nagendar.m

Hi ammu the interviewer doesn't mean to ask the abrivation
of the jdbc.
see, i can justify my ans for this Q? hav a look.

jdbc is an API provided to connet various DB's from a java
program and as part of jdbc there are 4 types of drivers
avilable to connect DB.
>Type-I to Type-IV
>in projects we use Type-IV driver which is called Thin
driver OR we use the combination of thin and Type-III
driver.
>Sample code: Using Thin driver and Oracle DB.

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

String url="jdbc:oracle:thin:@localhost:1521:server";

Connection connection=DriverManager.getConnection
(url,"SCOTT","TIGER");

PreparedStatement ps=connection.prepareStatement("SELECT *
FROM EMPLOYEE");

ResultSet rs=ps.executeQuery();

i think this Explination is fine...

Is This Answer Correct ?    28 Yes 0 No

what is jdbc?..

Answer / ammu

java database connectivity

Is This Answer Correct ?    18 Yes 7 No

what is jdbc?..

Answer / vishal

2nd and 3rd both answer is correct.

Is This Answer Correct ?    3 Yes 0 No

what is jdbc?..

Answer / rice

Java database connectivity is a service technology from sun
micro systems.
It is a J2EE service technology from sun micro systems.

The main objective of this service technology is to persist
the Java Object state into the file system permanently.i.e
store the Java Object state into Relational model i.e in
database product.

Is This Answer Correct ?    0 Yes 1 No

what is jdbc?..

Answer / nivas

java database connection or connectivety

Is This Answer Correct ?    0 Yes 1 No

what is jdbc?..

Answer / rohil

JDBC IS JAVA DATABASE CONNECTIVITY

this is used to get our java code connected with database
so that everytime we execute our code we dont have to start
from beginnning ...ie again making objects and giving
values again...with databse connectivty u can store the
data once and for all...

package com.mypack;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.*;
import oracle.jdbc.driver.*;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet Class
*
* @web.servlet name="CDataAccess"
* display-name="Name for
CDataAccess"
* description="Description for
CDataAccess"
* @web.servlet-mapping url-pattern="/CDataAccess"
* @web.servlet-init-param name="A parameter"
* value="A value"
*/
public class CDataAccess extends HttpServlet {
Connection con=null;
Statement st=null;
PrintWriter out=null;
ResultSet rs=null;
public CDataAccess() {
super();
// TODO Auto-generated constructor stub
}

protected void doGet(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException,
IOException {
// TODO Auto-generated method stub
//super.doGet(req, resp);
out=resp.getWriter();
String prodId=(String)req.getParameter
("txtProdId");
String prodName=(String)req.getParameter
("txtProdName");

try
{
//register the driver with the
application
DriverManager.registerDriver(new
oracle.jdbc.OracleDriver());
//connecting with the database
con=DriverManager.getConnection
("jdbc:oracle:thin:databse name:1521:javadb","name of
server","password");
//Connection c=getCon();
if(!con.isClosed() )
{
out.println("Connection
established");

st=con.createStatement();//creates
an object of statement
String query="insert into Products
values('"+prodId+"','"+prodName+"')";

int i=st.executeUpdate(query);
if(i>0)
{
out.println("Data
inserted"+"<br/>");
}
String q="select * from Products";
rs=st.executeQuery(q);
while(rs.next())
{
out.println(rs.getString
("PID")+","+rs.getString("PNAME")+"<br/>");

}
st.close();


}
}
catch(SQLException ex){

out.println(ex.getMessage());
}




}

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More Java Related AllOther Interview Questions

Is eclipse a jdk?

0 Answers  


why java has the size of character 2 byte ,while in c/c++ it is of 1 byte?

8 Answers   IBS,


What is contextpath in java?

0 Answers  


Why is struts used in java?

0 Answers  


How can I write a program that takes command line input?

0 Answers  


What is jsr in java?

0 Answers  


When is static variable loaded? Is it at compile time or runtime? When exactly a static block is loaded in java?

0 Answers  


What is jboss in java?

0 Answers  


What is java persistence api used for?

0 Answers  


What is dependency injection in java?

0 Answers  


Why oracle type 4 driver is named as oracle thin driver?

0 Answers  


Do I need to install jre if I have jdk?

0 Answers  


Categories