0% found this document useful (0 votes)
31 views3 pages

J2EE Test - 01

Jar files are used to compress multiple files into a single file. They can contain Java source code files (.java), bytecode files (.class), and configuration files like XML and properties files. Jar files are needed to import properties based on requirements. They provide abstraction, loose coupling between code and implementations, and help avoid costly resources and null pointer exceptions. The JDBC API specification defines a standard interface for connecting to databases. It allows loose coupling between Java code and databases. Key steps in JDBC include loading and registering the driver, establishing a connection, executing queries, and closing resources.

Uploaded by

Prajwal Raichan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

J2EE Test - 01

Jar files are used to compress multiple files into a single file. They can contain Java source code files (.java), bytecode files (.class), and configuration files like XML and properties files. Jar files are needed to import properties based on requirements. They provide abstraction, loose coupling between code and implementations, and help avoid costly resources and null pointer exceptions. The JDBC API specification defines a standard interface for connecting to databases. It allows loose coupling between Java code and databases. Key steps in JDBC include loading and registering the driver, establishing a connection, executing queries, and closing resources.

Uploaded by

Prajwal Raichan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1. What is Jar File?

Jar means Java Archive (Compressed). It is a file format based on zip file format which is used to
compress many files into one single file.
2. Contents of Jar File:
1) .java: contains source code statements in it.
2) .class: contains byte code statements in it.
3) ConfigFiles: contains only configuration data in it.
a) .xml: it is used to configure a resource with the help of custom tags/user defined tags.
b) .properties: It is used to provide a set of properties in the form of key and value pair
where the key must be unique.

3. Need for Jar File:


Jar File is needed to import the properties based on the requirement.

4. Define the following


a. Abstraction:
Hiding the implementation and providing the functionalities to user with the help of
interface is known as abstraction.

b. Interface:
Interface is the media to communicate between user and any device.

c. Loose Coupling:
Change in the implementation which doesn’t affect the user is known as Loose Coupling.

d. Tight Coupling:
Change in the implementation which affect the user is known as Tight Coupling.

e. Factory/Helper Method:
It is used to create implementation object.

f. NullPointerException:
Pointing towards an object which is not present throws an exception called
NullPointerException.

g. Costly Resources:
The resources which make use of system properties in the form of stream are known as
costly resources.
h. Port Number:
Port number is the one which helps us to get connected to a particular server.
Port numbers are provided by the respective servers which must be unique but can be
changed.

5. Name the Driver classes along with their Port Number


a. OracleDriver
b. Driver
c. SQLServerDriver
d. EmbeddedDriver

a. Oracle Server: 1521


b. MySQL Server: 3306
c. MS-SQL Server:1433
d. Derby Server: 1527

6. Why is JDBC Driver an implementation of JDBC API?


Since all the Driver classes must mandatorily implements java.sql.Driver Interface which
is a part of JDBC API. Hence JDBC Driver is an implementation of JDBC API.

7. Define JDBC and mention all the steps of JDBC.


Java DataBase Connectivity is a specification which is given in the form of abstraction
API to achieve Loose Coupling between java application and database server.

Steps of JDBC:
a. Load and Register the Driver.
b. Establish a connection with the Database Server.
c. Create a Statement or a Platform.
d. Execute the SQL Queries or SQL Statements.
e. Process the resultant data.
f. Close all the Costly Resources.

Advantages:
• We can achieve Loose Coupling between java application and database server.
• JDBC is platform Independent.
8. Explain class Loading in brief?
It is the process of Loading the .class file from the hardisk memory to JVM memory is
known as class loading.

There are 2 different ways in which a class be loaded


a. By calling any of the member of class which can either be a variable, method,
constructor, , block.
b. By using static method called forName( ) which is present in java.lang package
• Whenever we use this method, it throws an exception called
“ClassNotFoundException” which is a checked exception.
• forName( ) is declared inside a class by name Class.
• forName( ) always returns a loaded class based on the fully qualified class name.

Syntax: Class.forName(“Fully Qualified Class Name”);

You might also like