ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories >> Software >> Java-Related >> Java-J2EE >> JDBC
 
 


 

Back to Questions Page
 
Question
I have written a program to connect to database using 
odbc.Can this Application run on any Platform????
Rank Answer Posted By  
 Question Submitted By :: Satya
I also faced this Question!!   © ALL Interview .com
Answer
The most important thing in these products is that JaySQL 
can run on other platforms besides Windows, including 
Linux, Sun Solaris and Apple Mac. 

JaySQL is a 100% pure Java solution and therefore, can run 
on any Java compatible platforms.

where as WinSQL is there in ODBC which can run only on 
microsoft platform like (Win9x, NT, Win2000, XP or 2003)
basically ODBC is a microsoft product so its platform 
dependent so we can not run that code on all environment.
 
0
Sejal
 
 
Question
Hi friends, In JDBC  4 drivers are there  among this which
driver is best and why it is best.Which driver is most
commonly used in web applications.
Rank Answer Posted By  
 Question Submitted By :: Rajendra007
I also faced this Question!!   © ALL Interview .com
Answer
alljava because it's have capability work with any data 
base and cliet did not requeried to install any software.
 
0
Vinayak_ankam
 
 
Answer
Among jdbc driver TYPE-III driver(or) Net protocol driver is
best. because their is no worry about connection object and
connection pooling,middleware services.THe jdbc connection
are  over all taken by application server.A programer just
use the connection object.
In webapplication TYPE-III driver are mostly used.To work
with TYPE-III driver are in application server
 
0
Srinu
 
 
 
Answer
Type 4 Driver will be the best driver.Because the java
application will directly interacts with database without
middlewares. We want a jar file to connect directly(i.e
mysql connector jar file for mysql,ojdbc.jar to pracle
database).
 
0
Rajesh
 
 
Answer
ok , friend see ,there are three drivers and one protocol
which is type-3 ,ok.
My recommendation is  to use type-4 dirver , why , because
it has seveal advantages than the predecessor drivers.
Advantages
----------
->It is directly interacting with database software.
->It does not need much conversions to be included.
->It is compatible with internet program and applet programs
like this many advantages are there list will go on.
ok, now , if you are developing 2-tier project than use
type-4 dirver , if it is web application than use type-3
with type-4 ok
for more information  call 9989683928 , i belong to hyd
 
0
Priyabrata Patro
 
 
Answer
Because Type IV driver classes are written purely in
java.and it interacts directly with the database we dont
need to specify any ODBC to interact with the database.
 
0
Vicky
 
 
Answer
Type-4 driver. i.e,
Oracle JDBC Driver
 
0
Ranjith
 
 
Question
how can we get the metaData (columnNames) from a table which
has no Records..
Rank Answer Posted By  
 Question Submitted By :: Neeraj_passion2001
I also faced this Question!!   © ALL Interview .com
Answer
Hi,
You can use DatabasrMetaData class to get the databse 
information like... schenmaname, tables, columnnames, 
etc....

DatabaseMetaData metaData = new DBConnection().getMetaData
();
 
0
Sreenivas
 
 
Answer
we get it from ResultSetMetaData
 
0
Srinivas
[SOWSIA INDIA PVT LTD]
 
 
Question
Is JDBC a language or Application?
Rank Answer Posted By  
 Question Submitted By :: Guest
I also faced this Question!!   © ALL Interview .com
Answer
jdbc is an application
 
5
Meenal Sayali
 
 
Answer
JDBC is neither a language nor an application.
Than what is it?
It is a specification given by sun microsystem .You just
think about while you are working with JDBC concept you are
commonly using certain objects like Connection,Statement etc.
If it was not a specification than we would have to refer
each drivers information.
And about application see you are using JDBC concept to
create JDBC application but it is not itself an application
, and about language since it is part of java than you can
say it is sub-technology of java.
 
0
Priyabrata Patro
 
 
Question
write a query to select name from one table which has 
id,name and salary from another table which has id, sal 
where the salary is the second maximum
Rank Answer Posted By  
 Question Submitted By :: Anonymus
This Interview Question Asked @   Bosch , Infosys, Hirecraft
I also faced this Question!!   © ALL Interview .com
Answer
Select emp.name, emp.id, sal.salary from empDetai emp, 
empSal sal 
where emp.id=
  (select innnerEmp.id from 
   (select innerEmpSal.id, innerEmpSal.sal from empSal    
order        innerEmpSal.salary desc

    ) where rowid=2;

  )
And emp.id=sal.id;

This queiry initially execute the inner query and sort 
records based on the salary. second inner query returns the 
id of second maximum salary.
 
0
Bln
 
 
Answer
select emp.name,emp.id,sal.salary from empDetail emp,empSal
sal where sal.salary < (select max(salary) from empSal) and
emp.id=sal.id order by desc limit 1;
 
0
Raveendra Reddy
 
 
Question
how to prevent finally block from execution
Rank Answer Posted By  
 Question Submitted By :: Anonymus
This Interview Question Asked @   Bosch
I also faced this Question!!   © ALL Interview .com
Answer
System.exit(0) prevents execution of finally block
 
0
Bln
 
 
Answer
System.err() will also do
 
0
Gj69463
 
 
Answer
System.exit(0) prevents execution of finally block
 
0
Srinu
 
 
Question
how do we get the connection from connection pool
Rank Answer Posted By  
 Question Submitted By :: Navaz
I also faced this Question!!   © ALL Interview .com
Answer
import java.io.*;
import java.sql.*;
inport javax.sql.*;
import javax,servlet.http.*;
public class connection extends HttpServlet
{
  public void service(HttpServletRequest
req,HttpServletResponse res)throws ServletException,IOException
{
 Connection con=makeConnectionPool();
Statement st =con.createStatement();
  
----------reqular code as like as jdbc--------









}
public void Connection makeConnectionPool()
{
  Connection con=null;
  try
{
InitialContext ic =new InitialContext();
DataSource ds =(DataSource)ic.lookUp(" jndi logical Name in
 Application server");
 con=ds.getcConnection();
}catch(Exception e)
{
e.printStackTrace();
}
return con;
}



Note:-First u create logical name of jndi in application
server and refer this api javax.sql.*
 
0
Paletipatisrinu
 
 
Question
how to use CallableStatement?
specially how to use their index given ..
Rank Answer Posted By  
 Question Submitted By :: Gaursh
I also faced this Question!!   © ALL Interview .com
Answer
CallableStatement object is used to call the stored
procedure and stored procedure is nothing but it's block of
code and it's identified unique name

ex

CallableStatement cs=con.prepareCall();
cs.executeUpdate(Call"{procedure name}");


con is a Connection object
It has three parameter

IN
OUT
INOUT

IN parameter used to store any value to stored procedure
using setXX() method..

OUT parameter used to get the information or values from the
stored procedure using getXX() method,that object to
registered using registerOutParameter()

INOUT used to both store and get the information...
 
0
Suresh
 
 
Question
what is the current version of JDBC? and explain its 
features?
Rank Answer Posted By  
 Question Submitted By :: Koundinya_1993
I also faced this Question!!   © ALL Interview .com
Answer
JDBC 4.0,
Some of the new set of features which come along with 
Mustang is JDBC 4.0 are:

No need for Class.forName("DriverName") 

Changes in Connection and Statement Interface 

Better Pools 

Using ResultSet Becomes More Flexible 

More APIs Become Available

 
0
Koundinya_1993
 
 
Question
Hi........I need to create a dropdown box using
java.....this box should show the values that should be
taken from the database......


Thank you....
Rank Answer Posted By  
 Question Submitted By :: Sajukannan
I also faced this Question!!   © ALL Interview .com
Answer
That is very basic question when one new face comes into
development side...

we have <select> tag in jsp and it's <option> tag for no of
options.

steps
1.get all string data in array or arraylist or any iterator
from data base..

2.write select tag in jsp(php/asp) page.

3.make one loop inside it. of array's length or size.

4. in between option tag's value as array's elements..
 
0
Ketan
 
 
 
Back to Questions Page
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com