This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
At the beginning Java was known as "oak" but it was renamed as Java in 1995. The main aim of this language was to provide platform independent language that could be used to create software to be embedded in various consumer electronic devices.
Features of Java
Java is a programmer's language.
Java is cohesive and consistent.
Except for those constraints imposed by the Internet environment Java gives the programmer full control.
Java is to Internet programming where C was to system programming.
Importance of Java to the Internet
Java has had a profound effect on the Internet because it allows objects to move freely in Cyberspace. In a network there are two categories of objects that are transmitted between the Server and the Personal computer.
Dynamic active programs
The Dynamic Self-executing programs cause serious problems in the areas of Security and probability. But Java addresses those concerns and by doing so has opened the door to an exciting new form of program called the Applet.
Java can be used to create two types of programs
Applications: An application is a program that runs on our Computer under the operating system of that computer. It is more or less like one creating using C or C++. Java's ability to create Applets makes it important.
Applet: An Applet is an application designed to be transmitted over the Internet and executed by a Java compatible web browser. An applet is actually a tiny Java program, dynamically downloaded across the network, just like an image. But the difference is it is an intelligent program, not just a media file. It can react to the user input and dynamically change.
Features of Java Security
Every time you that you download a program you are risking a viral infection. Prior to Java, most users did not download executable programs frequently and most users were worried about the possibility of infecting their systems with a virus. Java answers both these concerns by providing a "firewall" between a network application and your computer. When you use a Java-compatible Web browser, you can safely download Java applets without fear of virus infection.
For programs to be dynamically downloaded to all the various types of platforms connected to the Internet, some means of generating portable executable code is needed .As you will see, the same mechanism that helps ensure security also helps create portability. Indeed Java's solution to these two problems is both elegant and efficient.
Java Virtual Machine (JVM)
Beyond the language there is the Java virtual machine. The Java virtual machine is an important element of the Java technology. The virtual machine can be embedded within a web browser or an operating system. Once a piece of Java code is loaded onto a machine, it is verified. As part of the loading process, a class loader is invoked and does byte code verification makes sure that the code that's has been generated by the compiler will not corrupt the machine that it's loaded on. Byte code verification takes place at the end of the compilation process to make sure that is all accurate and correct
Java architecture provides a portable, robust, high performing environment for development. Java provides portability by compiling the byte codes for the Java Virtual Machine, which is then interpreted on each platform by the run-time environment
Compilation of code
When you compile the code, the Java compiler creates machine code (called byte code) for a hypothetical machine called Java Virtual Machine (JVM). The JVM is supposed to execute the byte code. The JVM is created for overcoming the issue of portability. The code is written and compiled for one machine and interpreted on all machines. This machine is called Java Virtual Machine.
Java was designed to be easy for the Professional programmer to learn and to use effectively. If you are an experienced C++ programmer, learning Java will be even easier. Because Java inherits the C/C++ syntax and many of the objects oriented features of C++. Most of the confusing concepts from C++ are either left out of Java or implemented in a cleaner, more approachable manner
Java was not designed to be source-code compatible with any other language. This allowed the Java team the freedom to design with a blank slate. One outcome of this was a clean usable, pragmatic approach to objects. The object model in Java is simple and easy to extend while simple types such as integers are kept as high-performance non-objects.
The multi-platform environment of the Web places extraordinary demands on a program, because the program must execute reliably in a variety of systems. The ability to create robust programs was given a high priority in the design of Java. Java is strictly typed language; it checks your code at compile time and run time. Java virtually eliminates the problems of memory management and de-allocation, which is completely automatic. In a well-written Java program, all run time errors can -and should -be managed by your program.
The Java web server is JavaSoft's own web Server. The Java web server is just a part of a larger framework, intended to provide you not just with a web server, but also with tools. To build customized network servers for any Internet or Intranet client/server system. Servlets are to a web server, how applets are to the browser.
Servlets provide a Java-based solution used to address the problems currently associated with doing server-side programming, including inextensible scripting solutions, platform-specific APIs, and incomplete interfaces.
Servlets are objects that conform to a specific interface that can be plugged into a Java-based server. Servlets are to the server-side what applets are to the client-side - object byte codes that can be dynamically loaded off the net. They differ from applets in that they are faceless objects (without graphics or a GUI component). They serve as platform independent, dynamically loadable, pluggable helper byte code objects on the server side that can be used to dynamically extend server-side functionality.
For example, an HTTP Servlets can be used to generate dynamic HTML content. When you use Servlets to do dynamic content you get the following advantages:
They're faster and cleaner than CGI scripts
They use a standard API (the Servlets API)
They provide all the advantages of Java (run on a variety of servers without needing to be rewritten)
There are many features of Servlets that make them easy and attractive to use.
Easily configured using the GUI-based Admin tool
Can be loaded and invoked from a local disk or remotely across the network.
Can be linked together, or chained, so that one Servlets can call another Servlets, or several Servlets in sequence.
Can be called dynamically from within HTML pages, using server-side include tags.
Are secure - even when downloading across the network, the Servlets security model and Servlets sandbox protect your system from unfriendly behavior.
Advantages of the Servlet API
One of the great advantages of the Servlet API is protocol independence. It assumes nothing about:
The protocol being used to transmit on the net
How it is loaded
The server environment it will be running in
Features of Servlets:
Servlets are persistent. Servlet are loaded only by the web server and can maintain services between requests.
Servlets are fast. Since Servlets only need to be loaded once, they offer much better performance over their CGI counterparts.
Servlets are platform independent.
Servlets are extensible. Java is a robust, object-oriented programming language, which easily can be extended to suit your needs
A Servlet invoker is a Servlet that invokes the "service" method on a named Servlet. If the Servlet is not loaded in the server, then the invoker first loads the Servlet (either from local disk or from the network) and the then invokes the "service" method. Also like applets, local Servlets in the server can be identified by just the class name. In other words, if a Servlet name is not absolute, it is treated as local.
A client can invoke Servlets in the following ways:
The client can ask for a document that is served by the Servlet.
The client (browser) can invoke the Servlet directly using a URL, once it has been mapped using the Servlet Aliases section of the admin GUI.
The Servlet can be invoked through server side include tags.
The Servlet can be invoked by placing it in the Servlets/ directory.
The Servlet can be invoked by using it in a filter chain.
Java Database Connectivity
What Is JDBC?
JDBC is a Java API for executing SQL statements. (As a point of interest, JDBC is a trademarked name and is not an acronym; nevertheless, JDBC is often thought of as standing for Java Database Connectivity. It consists of a set of classes and interfaces written in the Java programming language. JDBC provides a standard API for tool/database developers and makes it possible to write database applications using a pure Java API.
Using JDBC, it is easy to send SQL statements to virtually any relational database. One can write a single program using the JDBC API, and the program will be able to send SQL statements to the appropriate database. The combinations of Java and JDBC lets a programmer write it once and run it anywhere.
What Does JDBC Do?
Simply put, JDBC makes it possible to do three things:
Establish a connection with a database
Send SQL statements
Process the results.
JDBC versus ODBC and other APIs
At this point, Microsoft's ODBC (Open Database Connectivity) API is that probably the most widely used programming interface for accessing relational databases. It offers the ability to connect to almost all databases on almost all platforms.
So why not just use ODBC from Java? The answer is that you can use ODBC from Java, but this is best done with the help of JDBC in the form of the JDBC-ODBC Bridge, which we will cover shortly. The question now becomes "Why do you need JDBC?" There are several answers to this question:
ODBC is not appropriate for direct use from Java because it uses a C interface. Calls from Java to native C code have a number of drawbacks in the security, implementation, robustness, and automatic portability of applications.
A literal translation of the ODBC C API into a Java API would not be desirable. For example, Java has no pointers, and ODBC makes copious use of them, including the notoriously error-prone generic pointer "void *". You can think of JDBC as ODBC translated into an object-oriented interface that is natural for Java programmers.
ODBC is hard to learn. It mixes simple and advanced features together, and it has complex options even for simple queries. JDBC, on the other hand, was designed to keep simple things simple while allowing more advanced capabilities where required.
A Java API like JDBC is needed in order to enable a "pure Java" solution. When ODBC is used, the ODBC driver manager and drivers must be manually installed on every client machine. When the JDBC driver is written completely in Java, however, JDBC code is automatically installable, portable, and secure on all Java platforms from network computers to mainframes.
Two-tier and three-tier Models
The JDBC API supports both two-tier and three-tier models for database access.
In the two-tier model, a Java applet or application talks directly to the database. This requires a JDBC driver that can communicate with the particular database management system being accessed. A user's SQL statements are delivered to the database, and the results of those statements are sent back to the user. The database may be located on another machine to which the user is connected via a network. This is referred to as a client/server configuration, with the user's machine as the client, and the machine housing the database as the server. The network can be an Intranet, which, for example, connects employees within a corporation, or it can be the Internet.
Java applet or
Client machine (GUI)
HTTP, RMI, or CORBA calls
Server machine (business Logic)
In the three-tier model, commands are sent to a "middle tier" of services, which then send SQL statements to the database. The database processes the SQL statements and sends the results back to the middle tier, which then sends them to the user. MIS directors find the three-tier model very attractive because the middle tier makes it possible to maintain control over access and the kinds of updates that can be made to corporate data. Another advantage is that when there is a middle tier, the user can employ an easy-to-use higher-level API which is translated by the middle tier into the appropriate low-level calls. Finally, in many cases the three-tier architecture can provide performance advantages.
Until now the middle tier has typically been written in languages such as C or C++, which offer fast performance. However, with the introduction of optimizing compilers that translate Java byte code into efficient machine-specific code, it is becoming practical to implement the middle tier in Java. This is a big plus, making it possible to take advantage of Java's robustness, multithreading, and security features. JDBC is important to allow database access from a Java middle tier.
JDBC Driver Types
The JDBC drivers that we are aware of at this time fit into one of four categories:
JDBC-ODBC bridge plus ODBC driver
Native-API partly-Java driver
JDBC-Net pure Java driver
Native-protocol pure Java driver