World's most popular travel blog for travel bloggers.

These languages are particularly oriented towards describing the procedures for solving the
problem in a concise, precise and unambiguous manner. Every high level
language follows a precise set of rules. They are developed to allow application
programs to be run on a variety of computers. These languages are machine independent. Languages falling in this category are FORTRAN, BASIC,PASCAL etc. They are easy to learn and programs may be written in these
languages with much less effort. However, the computer cannot understand
them and they need to be translated into machine language with the help of
other programs known as Compilers or Translators.

Prior to writing C programs, it would be interesting to find out what really is the C
language, how it came into existence and where does it stand with respect to other
computer languages. We will briefly outline these issues in the following section.

 

 The HTML DOM is defined as:


 A standard object model for HTML
 A standard programming interface for HTML
 A W3C standard

The HTML DOM defines the objects and properties of all HTML elements. It also
defines the methods required to access HTML elements. In other words “The HTML
DOM is a standard for how to fetch, modify, add, or delete HTML elements.”

 In this section, you will learn about the JDBC API. The JDBC provides a set of classes and

interfaces that can be used to write database applications. The JDBC API (Application
Programming Interface) is implemented by JDBC drivers. A JDBC driver is a software
component that enables a Java application to interact with a database. The JDBC core API is
found in the java.sql package and additional optional extensions for JDBC are found in
javax.sql package such as connection pooling, rowsets and distributed transactions. The most
important members of JDBC API are as follows:


 DriverManager class
 Connection interface
 Statement interface
 Prepared and Callable Statement Interface
 ResultSet interface

The Driver Manager Class
The task of Driver Manager class is to maintain a list of JDBC drivers. This list contains
information about the object reference of drivers and subprotocols that it supports. When a
program requests a database connection with getConection() method call, the Driver Manager
goes through the list and match a suitable driver. Each JDBC driver must be registered with
the Driver Manager. The JDBC drivers are provided by the database vendor or third party.
You can use different JDBC drivers for different database servers.

The most important method of Driver Manager class is getConnection() that returns a
java.sql.Connection object. The signatures of this method are as follows:

public static Connection getConnection(String url)
public static Connection getConnection(String url, Properties info)
public static Connection getConnection(String url, String user, String password)

You can write connection string like the following way:

Connection con = DriverManager.getConnection(dbURL);

The dbURL is specified in the following manner:

protocol:subprotocol:other parameter

For example:

jdbc:microsoft:sqlserver://127.0.0.1:1433;user=dbusername; password=dbpwdname;
DatabaseName=dbname;

The protocol should be jdbc. The subprotocol represents database type. This may be
Microsoft SQL Server, Oracle, MySql, jdbdc:odbc and so forth. In the above case, it is
Microsoft SQL Server. In other parameter category, IP address of the system, port number
such as 1433 for Microsoft SQL Server and name, password, username of the database. The
above definition is depends on the type of JDBC driver and database vendor.

The Connection Interface
This interface declares the methods that can be used to create a connection for particular
database. An instance of the connection interface is obtained from getConnection() method of the DriverManager class. After creating the connection with database, you can execute SQL statements for that particular connection and retrieve the results.
Some of the methods are listed below:

createStatement() method

The createStatement() method is used to create a statement object for sending SQL
statements to the database. If you are using the same SQL statement in your application many
times, it is more efficient and suitable to use a PreparedStatement object. Its signature of
createStatment() method is as follows:

public Statement createStaement() throws SQLException

prepareStatement() method
This method is used to create a PreparedStatement object. Its signature is as follows:

public PreparedStatement prepareStatement() throws SQLExecption

close() method
The close() method is used to immediately close and release a Connection object. Its
signature is as follows:
public void close() throws SQLException

The Statement Interface

The statement interface provides methods for executing SQL statements and obtains the
results that are produced. The following is the two important method of Statement interface
i.e. executeQuery() and executeUpdate(). Both are used for execution of SQL queries. The
signature for both methods is as follows:
public int executeUpdate(String sql) throws SQLException
public ResultSet executeQuery(String sql) throws SQLException

executeUpdate() method
The executeUpdate() method is used to executes an insert, delete, update SQL statements and
also DDL statements to create, drop and alter tables. It returns the row count for insert,
update, delete statement and returns zero(0) for SQL statement that return nothing.

executeQuery() method
The executeQuery() method is used to executes an SQL select statement that returns a single
ResultSet object which contains data.

execute() method
execute() method is used to execute stored procedure.

Prepared and Callable Statement Interface

Prepared Statement Interface
When you are used same SQL statements over and over again changing only parameter
values, it is best way to use prepared statement i.e. java.sql.PreparedStatement. The
PreparedStatement differ from simple Statement in that it specified fill-in-blanks SQL
template.

For example, “insert into tablename values (?, ?)”

There is a two unknown parameter in the form of question marks which are set at the run time
by your application using setXXX() method such as setString(), setInt(). The
PreparedStatement is a precompiled statement and has a query plan generated for it once. It is
mainly used to speed up the process of insertion, deletion and updation especially when there
is a bulk processing. When the program sends SQL queries to database engine, the query is
parsed, compiled and optimized, the outcome of this process is called query plan.

For example:
PreparedStatement pstmt = con.prepareStatement(“update product_table set productcode = ?
where product_name like ?”);

pstmt.setString(1, P001);
pstmt.setString(2, “Washing Machine”);
ResultSet rs = pstmt.executeUpdate();


Here, ? represents a modifiable value in SQL statement. You can set the value of unknown
parameter i.e. question mark with setXXX() method which specifies a parameter number and
a value.

The Callable Statement Interface
A Callable statement is used for handling stored procedure. A stored procedure is one or
more SQL statement stored as a one group in a compiled form inside a database engine. You
can simply call the store procedure as you call a method call. It is an extension of
PreparedStatement. The CallableStatement’s object is obtained from
Connection.prepareCall() method and set the parameter using setXXX() methods. The
execute() method is used to execute stored procedure.

For example:

CallableStatement cs = con.prepareCall(“{call myProcedure}”);
ResultSet rs = cs.executeQuery();

The ResultSet Interface
The ResultSet interface represents an object that contains data in the form of row and column.
The ResultSet object maintains record pointer that points to its current row of data. Initially,
the cursor is positioned before the first row. By default, the record pointer of ResultSet object
is forward only scrollable. You can traverse through the ResultSet using next() method only.
The next() method returns false when the last record is reached and no more details can than
be retrieved. The java.sql.ResultSet interface provides several methods for retrieving column

  Today, the most widely used interface to access database is ODBC. ODBC stands for Open Database Connectivity. It is a standard in relational database connectivity published by Microsoft (though originally developed jointly by Microsoft and Sybase). ODBC cannot be used directly with Java program because it uses a Programming Language C interface and it also makes use of Pointers which have been removed from Java. JDBC comes after the ODBC but JDBC is a Java API and contains Java interface for working with SQL

 The primary goal of the Internet is to provide an abstract view of the complexities

involved in it. Internet must appear as single network of computers. At the same time
network administrators or users must be free to choose hardware or various
internetworking technologies like Ethernet, Token ring etc. Different networking
technologies have different physical addressing mechanisms. Therefore, identifying a
computer on Internet is a challenge. To have uniform addressing for computers over
the Internet, IP software defines an IP address which is a logical address. Now, when
a computer wants to communicate to another computer on the Internet, it can use
logical address and is not bothered with the physical address of the destination and
hence the format and size of data packed

 Ans : The Internet layer is an important layer in the protocol suite. At this layer, TCP/IP

supports Internetworking Protocol (IP). IP is a host-to-host protocol. This layer is
responsible for the format of datagrams as defined by IP, and routing a datagram or
packet to the next hop, but is not responsible for the accurate and timely delivery of
datagrams to the destination in proper sequence. IP allows raw transmission functions
allowing user to add functionalities necessary for given application. Ensuring
maximum efficiency, TCP/IP supports four other protocols: ARP, RARP, ICMP and
IGMP in this layer.

• Address Resolution Protocol (ARP)
On a LAN, each machine is identified with a unique physical address imprinted
on the network interface card. ARP is used to find the physical address of a
machine when its IP address is known.

• Reverse Address Resolution Protocol (RARP)
It is used to find the IP address of a machine when its physical address is
known. It is used when a diskless computer is booted or a computer is
connected to the network for the first time.

• Internet Control Message Protocol (ICMP)
IP is unreliable are best effort delivery. In case of failures ICMP is used to send
notifications to the sender about packet problems. It sends error and query
messages.

• Internet Group Message Protocol (IGMP)
It is used for multicasting, which is transmission of a single message to a group
of recipients.

Transport Layer
At this layer, TCP/IP supports two protocols: TCP, UDP, IP is host-to-host protocol,
which can deliver the packet from one physical device to another physical device.
TCP, UDP, are transport level protocols, responsible for delivering a packet from one
process on a device to another process on the other device.

User Datagram Protocol (UDP)
It is simpler of the two protocols. It does not provide reliability. It is, therefore faster,
and using for applications in which delay is intolerable (in case of audio and video).

Transmission Control Protocol (TCP)
TCP is reliable, connection oriented protocol. By connection oriented, we mean that a
connection must be established between both ends before either can transmit data. It
ensures that communication is error-free and in sequence.

Application Layer
As said earlier, it is closer to combined session, presentation, and application layer of
OSI model. It allows the user to run various applications on Internet. These
applications are File Transfer Protocol (FTP), remote login (TELNET), email
(SMTP), WWW (HTTP). The session layer of OSI model is almost dropped in
TCP/IP

 The main reason is that each computer network is designed with a specific purpose.

For example, LAN is used to connect computers in a smaller area, and it provides fast
communication. As a result, networks become specialized identify. In many cases,
these networks do not use the same hardware and software technology. It means that,
a computer can communicate with the computers attached to the same network,
because they are indecomposable. As more and more organizations had multiple
computer networks, this became a major issue. As a result, the concept of
internetworking (internet) came into being. This means that there should be a network
of all physically separate networks.

 Communication

Communication the process of sharing ideas, information, and messages with others
at a particular time and place. Communication is a vital part of personal life and is
also important in business, education, and any other situation where people encounter
each other. Communication between two people is an outgrowth of methods
developed over centuries of expression. Gestures, the development of language, and
the necessity to engage in joint action all play a part. Communication, as we see it
today, has evolved a long way. We will discuss the primitive modes of
communication briefly.

i) Early Methods
Early societies developed systems for sending simple messages or signals that could
be seen or heard over a short distance, such as drumbeats, fire and smoke signals, or
lantern beacons. Messages were attached to the legs of carrier pigeons that were
released to fly home (this system was used until World War I, which started in 1914).
Semaphore systems (visual codes) of flags or flashing lights were employed to send
messages over relatively short but difficult-to-cross distances, such as from hilltop to
hilltop, or between ships at sea.

ii) Postal Services
The postal system is a system by which written documents normally enclosed in
envelopes, and also small packages containing other matter, are delivered to destinations
around the world. Anything sent through the postal system is called post.
In India the East India Company in Mumbai, Chennai and Calcutta introduced the
postal system in 1766, further these postal service became available to the general
public. Even after implementing different electronic communication mediums, postal
system is still one of the popular communication systems available.

iii) Telegraph
The first truly electronic medium for communication was the telegraph, which sent
and received electrical signals over long-distance wires. The first practical
commercial systems were developed by the physicist, Sir Charles Wheatstone and the
inventor Sir William F. Cooke in Great Britain, and by the artist and inventor Samuel
F. B. Morse in the United States. Morse demonstrated the first telegraph system in
New York in 1837. But regular telegraph service, relaying Morse code (system of
code using on and off signals), was not established until 1844. Telegraphers would
translate the letters of the alphabet into Morse code, tapping on an electrical switch,
or key. The telegrapher at the other end of the line would decode the tapping as it
came in, write down the message, and send it to the recipient by messenger. The
telegraph made it possible for many companies to conduct their business globally for
the first time.

iv) Telephone
Early devices capable of transmitting sound vibrations and even human speech
appeared in the 1850s and 1860s. The first person to patent and effectively
commercialize an electric telephone was Scottish-born American inventor Alexander
Graham Bell. Originally, Bell thought that the telephone would be used to transmit
musical concerts, lectures, or sermons.
The telephone network has also provided the electronic network for new
computer-based systems like the Internet facsimile transmissions, and the World
Wide Web. The memory and data-processing power of individual computers can be
linked together to exchange the data transmitted over telephone line, by connecting
computers to the telephone network through devices called modems (modulator demodulators).

v) Computers and Internet
The earliest computers were machines built to make repetitive numerical calculations
that had previously been done by hand. While computers continued to improve, they
were used primarily for mathematical and scientific calculations, and for encoding
and decoding messages. Computer technology was finally applied to printed
communication in the 1970s when the first word processors were created.

At the same time computers were becoming faster, more-powerful and smaller, and
networks were developed for interconnecting computers. In the 1960’s the Advanced
Research Projects Agency (ARPA) of the U.S. Department of Defense, along with
researchers working on military projects at research centers and universities across
the country, developed a network called the ARPANET, for sharing data and
processing time of uniform computer connection over specially equipped telephone
lines and satellite links. The network was designed to survive the attack or destruction
of some of its parts and continue to work.

Soon, however, scientists using the ARPANET realized that they could send and
receive messages as well as data and programs over the network. The ARPANET
became the first major electronic-mail network; soon thousands of researchers all
over the world used it. Later on the National Science Foundation (NSF) helped
connect more universities and non-military research sites to the ARPANET, and
renamed it the Internet because it was a network of networks among many different
organizations.

TCP/IP Protocols
Today, the Internet is the widely known computer network. It uses interconnection of
computer system by both wired and wireless. Smaller networks of computers, called
Local Area Networks (LANs), can be installed, in a single building or for a whole
organization. Wide Area Networks (WANs) can be used to span a large geographical
area. LANs and WANs use telephone lines, computer cables, and microwave and
laser beams to carry digital information around a smaller area, such as a single
college campus. Internet can carry any digital signals, including video images,
sounds, graphics, animations, and text, therefore it has became very popular
communication tool.

 Ans : Originally, the IP address space was divided into a few fixed-length structures called

address classes. The three main address classes are class A, class B, and class C. By
examining the first few bits of an address, IP software can quickly determine the
class, and therefore the structure, of an address. IP follows these rules to determine
the address class:

• Class A: If the first bit of an IP address is 0, it is the address of a class A
network. The first bit of a class A address identifies the address class. The next 7
bits identify the network, and the last 24 bits identify the host. There are fewer
than 128 class A network numbers, but each class A network can be composed of
millions of hosts.

• Class B: If the first 2 bits of the address are 1 0, it is a class B network address.
The first 2 bits identify class; the next 14 bits identify the network, and the last 16
bits identify the host. There are thousands of class B network numbers and each
class B network can contain thousands of hosts.

• Class C: If the first 3 bits of the address are 1 1 0, it is Internet Protocol a class C network
address. In a class C address, the first 3 bits are class identifiers; the next 21 bits
are the network address, and the last 8 bits identify the host. There are millions of
class C network numbers, but each class C network is composed of fewer than
254 hosts.


• Class D: If the first 4 bits of the address are 1 1 1 0, it is a multicast address.
These addresses are sometimes called class D addresses, but they don’t really
refer to specific networks. Multicast addresses are used to address groups of
computers all at one time. Multicast addresses identify a group of computers that
share a common application, such as a video conference, as opposed to a group of
computers that share a common network.

• Class E: If the first four bits of the address are 1 1 1 1, it is a special reserved
address. These addresses are called class E addresses, but they don’t really refer
to specific networks. No numbers are currently assigned in this range.

IP addresses are usually written as four decimal numbers separated by dots (periods).
Each of the four numbers is in the range 0-255 (the decimal values possible for a
single byte). Because the bits that identify class are contiguous with the network bits
of the address, we can lump them together and look at the address as composed of full
bytes of network address and full bytes of host address. If the value of the first byte
is:

• Less than 128, the address is class A; the first byte is the network number, and the
next three bytes are the host address.


• From 128 to 191, the address is class B; the first two bytes identify the network,
and the last two bytes identify the host.

• From 192 to 223, the address is class C; the first three bytes are the network
address, and the last byte is the host number.

• From 224 to 239, the address is multicast. There is no network part. The entire
address identifies a specific multicast group.

• Greater than 239, the address is reserved.

IP Address
Class
High
Order
Bit(s)
FormatRangeNo. of
Network
Bits
No. of
Host
Bits
Max
Hosts
Purpose
A0N.H.H.H1.0.0.0 to
126.0.0.0
7242^24 -2Few Large
Organizations
B1,0N.N.H.H128.1.0.0 to
191.254.0.0
14162^16 -2Medium-size
Organization’s
C1,1,0N.N.N.H192.0.1.0 to
223.255.254.0
2182^8 -2Relatively small
organization’s
D1,1,1,0N/A224.0.0.0 to
239.255.255.255
N/AN/AN/AMulticast groups
(REC 1112)
E1,1,1,1N/A240.0.0.0 to
254.255.255.255
N/AN/AN/AFuture Use
(Experimental)


The IP address, which provides universal addressing across all of the networks of the
Internet, is one of the great strengths of the TCP/IP protocol suite. However, the
original class structure of the IP address has weaknesses. The TCP/IP designers did
not envision the enormous scale of today’s network. When TCP/IP was being

designed, networking was limited to large organization’s that could afford substantial
computer systems. The idea of a powerful UNIX system on every desktop did not
exist. At that time, a 32-bit address seemed so large that it was divided into classes to
reduce the processing load on routers, even though dividing the address into classes
sharply reduced the number of host addresses actually available for use. For example,
assigning a large network a single class B address, instead of six class C addresses,
reduced the load on the router because the router needed to keep only one route for
that entire organization. However, an organization that was given the class B address
probably did not have 64,000 computers, so most of the host addresses available to
the organization were never assigned.
The class-structured address design was critically strained by the rapid growth of the
Internet. At one point it appeared that all class B addresses might be rapidly
exhausted. To prevent this, a new way of looking at IP addresses without a class
structure was developed.

 The incompatibility issues are handled at two levels:


i) Hardware Issues
At the hardware level, an additional component called router is used to connect
physically distinct networks as shown in Figure 1. A router connects to the network
in the same way as any other computer. Any computer connected to the network has a
Network Interface Card (NIC), which has the address (network id+host id), hard
coded into it. A router is a device with more than one NICs. Router can connect
incompatible networks as it has the necessary hardware (NIC) and protocols
(TCP/IP).



ii) Software Issues
The routers must agree about the way information would be transmitted to the
destination computer on a different network, since the information is likely to travel
through different routers, there must be a predefined standard to which routers must
confirm. Packet formats and addressing mechanism used by the networks may differ.
One approach could be to perform conversion and reconversion corresponding to
different networks. But this approach is difficult and cumbersome. Therefore, the
Internet communication follows one protocol, the TCP/IP protocol suite. The basic
idea is that it defines a packet size, routing algorithms, error control, flow control
methods universally.

TCP/IP Protocols It would be unwise to club all these features in a single piece of software ─ it would
make it very bulky. Therefore, all these features are logically sub-grouped and then
the sub-groups are further grouped into groups called layers. Each layer has an
interface with the adjacent layers, and performs specific functions.

Need for Layering
Since it is difficult to deal with complex set of rules, and functions required for
computer networking, these rules and functions are divided with logical groups called
layers. Each layer can be implemented interdependently with an interface to other
layers providing with services to it or taking its services like flow control and error
control functions are grouped together and the layer is called data link layer. Speech
in telephone conversation is translated, with electrical segments and vice-versa.
Similarly in computer system the data or pattern are converted into signals before
transmitting and receiving. These function and rules are grouped together in a layer
called physical layer.