|
INTERVIEW QUESTIONS
J2EE
JDBC
DETAILS
Question: What are the common tasks of JDBC?
Answer: import java.sql.*; class Type1 { public static void main(String[] args)throws Exception { Connection c=null; try { Driver d=new Driver("sun.jdbc.odbc.JdbcOdbc"); //or Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); c=DriverManager.getConnection("jdbc:odbc:emp1","scott","tiger"); Statement s=c.createStatement(); s.executeUpdate("insert into dept(deptno,loc)values(60,'hyd')"); } catch(Exception e) { e.printStackTrace(); } finally { c.close(); } } }
|
|
|
Category |
JDBC Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 7813 users |
Added on |
7/14/2011 |
Views |
71566 |
Rate it! |
|
|
Question:
What are the common tasks of JDBC?
Answer:
import java.sql.*; class Type1 { public static void main(String[] args)throws Exception { Connection c=null; try { Driver d=new Driver("sun.jdbc.odbc.JdbcOdbc"); //or Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); c=DriverManager.getConnection("jdbc:odbc:emp1","scott","tiger"); Statement s=c.createStatement(); s.executeUpdate("insert into dept(deptno,loc)values(60,'hyd')"); } catch(Exception e) { e.printStackTrace(); } finally { c.close(); } } } Source: CoolInterview.com
JDBC is a API its communicate with relational Databases. Source: CoolInterview.com
Answered by: vani.p | Date: 8/31/2008
| Contact vani.p
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What Class.forName( ) method will do?
|
View Answer
|
|
How to get the resultset of stroedProcedure
|
View Answer
|
|
How can store images in a data base?
|
View Answer
|
|
Why do we use prepared statement when already statement is present
|
View Answer
|
|
Which is the best driver among the 4 jdbc drivers?how can we load that driver?
|
View Answer
|
|
How many statements can be created with one connection
|
View Answer
|
|
If 4 different drivers are loaded, & created 4 different statements calling diffener tables from same database, how driver is recognized for each statement?
|
View Answer
|
|
What is metadata?
|
View Answer
|
|
Where to use which driver in JAVA?
|
View Answer
|
|
what is savepoint?
|
View Answer
|
|
How differ servlet from its peer Technology?
|
View Answer
|
|
What is the importance in context in jdbc connection pools?
|
View Answer
|
|
how can we connect database in java without using the Class.forname() method with our application?
|
View Answer
|
|
The interface _____________ helps us in retrieving the information about the database.
|
View Answer
|
|
Which of the following allows phantom read in JDBC, connection class?
|
View Answer
|
|
Which of the following allows non repeatable read in JDBC, connection class?
|
View Answer
|
|
Which isolation level prevents dirty read in JDBC, connection class.
|
View Answer
|
|
Which of the following is not an isolation level in the JDBC.
|
View Answer
|
|
Which method is static synchronized in JDBC API _________
|
View Answer
|
|
Different types of exceptions in JDBC are1. BatchUpdateException2. DataTruncation3. SQLException4. SQLWarning
|
View Answer
|