From Twitter

SOLUTIONS / ANSWERS

SOLUTIONS / ANSWERS

1) True or False

a) True

b) True

2) JDBC is a standard SQL database access interface that provides uniform access
to a wide range of relational databases. It also provides a common base on
which higher level tools and interfaces can be built. The advantages of using
Java with JDBC are:

• Easy and economical
• Continued usage of already installed databases
• Development time is short
• Installation and version control simplified

3) There are basically 4 types of drivers available in Java of which 2 are partly
pure and 2 are pure java drivers

Type 1: JDBC-ODBC Bridge.


They delegate the work of data access to ODBC API. This kind of driver is generally
most appropriate when automatic installation and downloading of a Java technology
application is not important.

Advantages: It acts as a good approach for learning JDBC. It may be useful for
companies that already have ODBC drivers installed on each client machine —
typically the case for Windows-based machines running productivity applications.

Disadvantage: It is not suitable for large-scale applications. They are the slowest of
all. The performance of system may suffer because there is some overhead associated
with the translation work to go from JDBC to ODBC. It doesn’t support all the
features of Java.

 Type 2: Native-API partly Java technology-enabled driver

 They mainly use native API for data access and provide Java wrapper classes to be
able to be invoked using JDBC drivers It converts the calls that a developer writes to
  the JDBC application programming interface into calls that connect to the client
machine’s application programming interface for a specific database, such as IBM,
Informix, Oracle or Sybase

Advantage: It has a better performance than that of Type 1, in part because the Type
2 driver contains compiled code that’s optimized for the back-end database server’s
operating system.

Disadvantage: In this, user needs to make sure the JDBC driver of the database
vendor is loaded onto each client machine. It must have compiled code for every
operating system that the application will run on.

Type 3: A net-protocol fully Java technology-enabled driver

They are written in 100% Java and use vendor independent Net-protocol to access a
vendor independent remote listener. This listener in turn maps the vendor independent
calls to vender dependent ones.

Advantage: It has better performance than Types 1 and 2. It can be used when a
company has multiple databases and wants to use a single JDBC driver to connect to
all of them. Since, it is server-based, so there is no requirement for JDBC driver code
on client machine.

Disadvantage: It needs some database-specific code on the middleware server. If the
middleware is to run on different platforms, then Type 4 driver might be more
effective.

Type 4: A native-protocol fully Java technology-enabled driver

It is Direct-to-database pure Java driver. It converts JDBC technology calls into the
network protocol used by different DBMSs directly. It allows a direct call from the
client machine to the database.

Advantage: It again has better performance than Types 1 and 2 and there is no need
to install special software on client or server. It can be downloaded dynamically


 Disadvantage: It is not optimized for server operating system, so the driver can't take
advantage of operating system features. For this, user needs a different driver for each
different database.

4) OBDC (Open Database Connectivity) cannot be used directly with java due to
the following reasons:

a) ODBC cannot be used directly with Java because it uses a C interface. This
will have drawbacks in the Security, implementation, and robustness.
b) ODBC makes use of Pointers, which have been removed from Java.
c) ODBC mixes simple and advanced features together and has complex
structure.

5) Statement object is one of the main objects of JDBC API, which is used for
executing the SQL queries. There are 3 different types of JDBC SQL
Statements are available in Java:
a) java.sql.Statement: It is the topmost interface which provides basic methods
useful for executing SELECT, INSERT, UPDATE and DELETE SQL
statements
b) java.sql.PreparedStatement: It is an enhanced version of
java.sql.Statement which is used to execute SQL queries with parameters
and can be executed multiple times.
c) java.sql.CallableStatement: It allows you to execute stored procedures
within a RDBMS which supports stored procedures



No comments:

Post a Comment

Labels

(MCS-031 (6) 2011 (5) 4nf (1) 5nf (1) ACCESS CONTROL In Relational Database (1) ALGORITHMICS (5) assignment 2014 2015 (1) AVAILABLE TOOLS & ALGORITHMS (5) BCA (1) BINARY SEARCH (1) Block Nested Loop Join (1) Build and Fix Model (1) BUILDING BLOCKS OF ALGORITHMS (1) CHARACTERISTICS OF AN ALGORITHM (2) Core Java (1) Data Communication Network Security (1) DATABASE SECURITY (1) EER tool (1) ELEMEMTARY ALGORITHMICS (2) ENHANCED ER TOOLS (1) EVOLUTION (1) EXAMPLE OF AN ALGORITHM (2) Indexed Nested-Loop Join (1) install servelet engine (1) INTRODUCTION (1) Iterative Enhancement Model (1) Java Server Pages (1) JDBC (1) JSP (2) LEVELS OF DATABASE SECURITY (1) MCA (9) MCA 051 (1) MCA 3rd Semester (8) MCA 4th Semester (1) MCA 5 sem (1) MCS-031 (7) MCS-031 : DESIGN AND ANALYSIS OF ALGORITHM (14) MCS-032 (1) MCS-033 (1) MCS-034 (2) MCS-035 (1) mcs-041 (2) MCS-042 (1) mcs-043 (2) mcs-052 solved assignment (1) MCSL-036 (2) Nested loop join (1) OBJECTIVES (1) Operating System (2) OUTLINE OF ALGORITHMICS (1) Principles of Management and Information Systems (1) PROBLEMS (1) QUERY PROCESSING AND EVALUATION (1) Query processing Optimisation (1) Question Papers (8) Related Topic (9) relational Database (1) SELECT OPERATION Query Processing (1) Servlet (1) Servlet Programme (1) Servlet Programming (1) SOFTWARE DEVELOPMENT MODELS (4) SOFTWARE ENGINEERING (4) Solution (7) Solved Assignment 2013 2014 (6) SOME PRE-REQUISITES AND Asymptotic Bounds ASYMPTOTIC BOUNDS INTRODUCTION (1) STATISTICAL DATABASE SECURITY (1) structure (1) SUMMARY (1) Waterfall Model (1) Write a C program to print the following triangle (1)