Java technology is a combination of programming language and a platform. This technology supports the state of art programs assisting the games, utilities also services related to the business applications. As of 2012, Java was one of the most important and wanted programming language, in particular for client-server based applications, with more than 10 million users. Java has become the most important part of performance & operations for lots of applications and websites. Without Java being installed, it might not be able to run or operate them, as it provides much secure, speed and efficiency.
The Java programming language is an authentic and object-oriented high level language. This language evolved from a language called Oak, which was developed in early 90’s as a mode of communication involved in entertainment appliances such as video games animation & also in VCR’s. Java is also addressed as interpreted language because of its byte code, which is created by the compilation of source code. This compiled source code is interpreted by JVM and is then converted to a machine dependent code which is also called as Native code.
The High-level programming language of Java is characterized by all of these following listed buzzwords:
With most programming languages, you either collate or depict a program so that you can run it on your computer. But, Java is particularly designed to reduce the number of dependencies as less as possible, during the process of implementation. The Java programming language is unusual, wherein a program is both compiled and interpreted. With the compiler, first program is first translated into an intermediate language called Java byte codes -the platform-independent codes interpreted by the interpreter on the Java platform. The interpreter determines and runs each Java byte code instruction on the computer. Compilation happens just once; interpretation occurs each time the program is executed. The following figure illustrates how this works.
Fig: 3.3 .1
Java is an Object oriented Programming concept which guides us to the core ideas & concepts behind object-oriented programming such as: Objects, messages, classes and interests. A clear picture of what are they, why you would want to write one and how to write is described clearly using the interfaces & inheritance, which are few among those object-oriented concepts of Java.
You can think of Java byte codes as the machine code instructions for the Java Virtual Machine (Java VM). Every Java interpreter, whether it’s a development tool or a Web browser that can run applets, is an employment of the Java VM. Java byte codes help make “write once, run anywhere” possible. The program can be congregated into byte codes on any platform that has a Java compiler. The byte codes can then be run on any implementation of the Java VM. That means that as long as a computer has a Java VM, the same program written in the Java programming language can run on Windows 2000, a Solaris workstation, or on an iMac.
The Java Platform
A platform is the hardware or software environment in which a program is set to run. The makers construct applications to match the actual requirements of users. An application may be created to provide service for one user at a time, many users at once or even to serve users at different locations at any given time. This platform of Java apprehends the various challenges that are generally faced by the developers and gives out a proposal of various choices of different technologies based on necessity of user’s needs. The two important aspects of this Java platform are the Java runtime environment (JRE) and the Java Development Kit (JDK). The Java runtime environment when equipped on to a computer provides the operating system with the means to run the programs of Java, whereas Java Development Kit is the combination of the tools that are being used by a programmer creating the Java based applications.
The Java platform versions contain additional Java API’s for generating various types of applications such as Java Standard edition, Java Enterprise Edition & Java Micro Edition. Java standard edition (Java SE) helps in creating desktop applications & applets. Basically this application is created to serve small number of users at once. Java enterprise edition (Java EE) is mended for complicated applications to make it more suitable for both medium and large business units, and this is designed as server based application so as to focus on serving the needs of more number of users at a time. Java Micro Edition is implemented on mobile and entrenched devices such as PDA, Printers, tuner box, Cell phones, etc.
We’ve already mentioned some of the most popular platforms like Windows 2000, Linux, Solaris, and MacOS. Most platforms can be characterized as an amalgamation of the operating system and hardware. The Java platform varies from most other platforms in that it’s a software-only platform that runs on top of other hardware-based platforms.
The two components of Java platform are:
The Java Virtual Machine (Java VM)
The Java Application Programming Interface (Java API)
Java VM is already introduce in previous sections as a base for the Java platform and is ported onto various hardware-based platforms.
The Java API is a huge assembly of ready-made software components that contributes many useful capabilities, such as graphical user interface (GUI) widgets. The Java API is grouped into libraries of related classes and interfaces; these libraries are known as packages.
The next section answers, What Can Java Technology Do?
This Section highlights what functionality some of the packages in the Java API will provide.
The following figure given below depicts a program that’s running on the Java platform. As the figure shows, the Java API and the virtual machine shields the program from the hardware.
Native code is code that after the completion of compilation, the compiled code is further processed or run on specific hardware platform. As a platform-independent environment, the Java platform is relatively slower compared to that of native code processing. However, smart compilers, well-tuned interpreters, and just-in-time byte code compilers combination would perform very close to that of native code without menacing the portability.
What Can Java Technology Do?
The most common types of programs written in the Java programming language are applets and applications. If browsed through net for related data, it makes it much easier and reliably familiar with applets context. An applet is a program that sticks to particular type of conventions that allow the Java enabled browser to run the applications faster. However, the Java programming language is not just for writing cute, entertaining applets for the Web. The general-purpose, high-level Java programming language is also a powerful software platform. The generous API can also be used to write different types of programs. Being a strong and most used programming language in day to day activities, the features gained by implementation of Java platform are development tools, Application programming interface (API), deployment technologies, user interface toolkits & integration libraries. These features provide all necessary tools needed for compiling, running, monitoring, debugging, and documenting the applications.
API was the key provider of core functionality which provided a vast cluster of useful classes ready for implementation in the user’s applications. The core concept of API is extremely wide so as to provide the different classes that are very much necessary for creation of an applet and the further classification of these applets were used to communicate with the applet contexts. It also helped in providing the standard mechanism for extending the applications to the end users. To make the creation of complicated Graphical User Interface more simple, user interface toolkits were used such as Swing & Java toolkits. To have an easy access to the database and collaboration of remote objects integration libraries feature was used.
An application is a stand-alone program that runs directly on the Java platform. A special kind of application known as a “server” serves and supports clients on a network. Examples of servers are Web servers, proxy servers, mail servers, and print servers. Another specialized program is a “servlet”. A servlet can almost be thought of, as an applet that runs on the server side. Java Servlets are a prevailing choice for building most interactive web applications, by replacing the use of CGI scripts.
Servlets are much similar to applets, where in the only difference between these two is that they are runtime extensions of applications. Instead of working in browsers, the servlets run within Java Web servers, configuring or tailoring the server.
How does the API support all these kinds of programs? It does so with packages of software components that provides a vast options for the functioning of applications. Every full implementation of the Java platform gives you the following features:
The essentials: Objects, strings, threads, numbers, input and output, data structures, system properties, date and time, and so on.
Applets: The set of conventions used by applets.
Networking: URLs, TCP (Transmission Control Protocol), UDP (User Data gram Protocol) sockets, and IP (Internet Protocol) addresses.
Internationalization: This helps in writing the programs that can be locally available for all the users worldwide. Programs can automatically adapt to specific locales and can also be displayed in the appropriate language according to the user requirements.
Security: Both low level and high level, including electronic signatures, public and private key management, access control, and certificates.
Software components: Known as JavaBeans, can plug into existing component architectures.
Object serialization: This feature allows the lightweight persistence and communication via Remote Method Invocation (RMI).
Java Database Connectivity (JDBCTM): Provides uniform access to a wide range of relational databases.
The Java platform also has different types of APIs that includes 2D and 3D graphics, accessibility, servers, collaboration, telephony, speech, animation, and more.
The following figure depicts what is included in the Java 2 SDK. Description: gs5
Java Technology’s Impact on User’s:
Even though Java technology cannot promise its users the fame, fortune, or even a job, it helps the users to learn the Java programming language. Java technology is one of those programming languages which has wide acceptance all over the world, with its huge amount of important and robust features. Still, it is likely to make the programs better and requires less effort than other languages which simplifies the process of understanding and implementing Java technology without any complications and confusions. Wide variety of dynamic, completely secured and safe independent applications can be created by implementing Java, which is the main reason behind that gradual and rapid increase in the number of users; and it is also believed that Java technology will help in doing the following functions/actions more effectively:
Get started quickly: Java being a user friendly programming language, it is very easy to write and understand. As the programming doesn’t need any pointers or memory to be managed explicitly, highly secured applications can be used without any interruptions. Although the Java programming language is a powerful object-oriented language, it’s makes the program or application easy to learn, especially for programmers already familiar with C or C++.
Write less code: Comparisons of program metrics (class counts, method counts, and so on) suggest that a program written in the Java programming language can be four times smaller than the same program in C++. Different rules of OOP’s (Object Oriented Programming) like inheritance, encapsulation, and polymorphism are followed during the processing/ while running the operation which makes Java different from other languages such C and C++.
Write better code: The Java programming language encourages good coding practices, and its garbage collection helps you avoid memory leaks. Its object orientation, its JavaBeans component architecture, and its wide-ranging, easily extendible API let you reuse other people’s tested code and introduce fewer bugs.
Develop programs more quickly: Your development time may be as much as twice as fast versus writing the same program in C++. Why? You write fewer lines of code and it is a simpler programming language than C++.
Avoid platform dependencies with 100% Pure Java: You can keep your program portable by avoiding the use of libraries written in other languages. The 100% Pure Java Product Certification Program has a repository of historical process manuals, white papers, brochures, and similar materials online.
Write once, run anywhere: Because 100% Pure Java programs are compiled into machine-independent byte codes, they run consistently on any Java platform.
Distribute software more easily: You can upgrade applets easily from a central server. Applets take advantage of the feature of allowing new classes to be loaded “on the fly,” without recompiling the entire program.
Communicating with remote objects distribute over the network is set through the Java programming. It contains all required data base in its libraries with sources such as RMI and CORBA which are very much essential to develop any network applications. All Primary data types can be considered as objects using covering classes to make Java a dully Object oriented, wherein class is considered a basic unit of Java and Objects are the entities which follow the prototypes that are defined by class.
Java applications are more reliable in different ways. It helps compile time checking to identify at early stages the causes of bugs, run time checking, eliminated the use of pointers which can usually cause the corruption of memory or unnecessary access of memory, waste/garbage collection management to free the unused memories automatically, barring handling to handle the situation at the time of occurrence of any error and a lot more.
Microsoft Open Database Connectivity (ODBC) is a standard programming interface for application developers and database systems providers. Before ODBC became a “defacto” standard for Windows programs to interface with database systems, programmers had to use proprietary languages for each database they wanted to connect to. Now, ODBC has made the choice of the database system which is highly irrelevant from a coding perspective, which is as it should be. Application developers have much more important things to worry about than that of which syntax is needed to port their program from one database to another when business needs that sudden change.
Through the ODBC Administrator in Control Panel, one can specify the particular database that is associated with a data source, wherein a ODBC application program is written to use. Think of an ODBC data source as a door with a name on it. Each door will lead the users to a particular database. For example, the data source named Sales Figures might be a SQL Server database, whereas the Accounts Payable data source could refer to an Access database. The physical database referred to by a data source can reside anywhere on the LAN.
The ODBC system files are not installed on users system by Windows 95. Rather, they are installed when the user setup a separate database application, such as SQL Server Client or Visual Basic 4.0. When the ODBC icon is installed in Control Panel, it uses a file called ODBCINST.DLL. It is also possible to conduct the user’s ODBC data sources through a stand-alone program called ODBCADM.EXE. There will be a 16-bit and a 32-bit version of this program and each of them are maintained as a separate list of ODBC data sources. From a programming perspective, the beauty of ODBC is that the application can always be written to use the same set of function calls to interface with any data source, irrespective of the database vendor. The source code of the application doesn’t change whether it negotiates to Oracle or SQL Server.
The only two examples that can be used at this point are as follows. There are ODBC drivers available for various dozen popular database systems. Even Excel spreadsheets and plain text files can be changed over into different data sources. The operating system implicates the Registry information written by ODBC Administrator to determine which low-level ODBC drivers are needed to talk to the data source (such as the interface to Oracle or SQL Server). The loading of the ODBC drivers is transparent to the ODBC application program. In a client/server environment, the ODBC API even controls many of the network issues for the application programmer.
The advantages of this scheme are various, this make the users to think that there must be some catch. The only disadvantage of ODBC is that it isn’t as efficient as talking directly to the native database interface. ODBC has had various detractors make the charge that it is too slow. Microsoft has always proved that the critical factor in performance is the quality of the driver software that is used. In our humble opinion, this is true. The availability of good ODBC drivers has improved a great deal recently. And anyway, the criticism about performance is somewhat analogous to those who said that compilers would never match the speed of pure assembly language.
Maybe not, but the compiler (or ODBC) gives users that opportunity to write cleaner programs, which means the users can finish their programming sooner. This faster compilation of program or application makes the computers get faster every year.
Java Database Connectivity (JDBC)
JDBC is a Java-based data access technology from Sun Microsystems. . In an accomplishment to set an independent database standard API for Java; Sun Microsystems developed Java Database Connectivity, or JDBC. This technology is an API for Java programming language that characterizes how a user gets access to the database. This connectivity offers various methods for challenging and updating the data into the users’ database. Aside from being easy to write, using the JDBC API, it is robust, secure, and automatically downloadable. Also, JDBC automatically appreciates these benefits of Java, by virtue of being written in Java.
JDBC is determined towards relational databases, and this bridge of JDBC – ODBC accredits the connection to any other ODBC accessible data source in the actual JVM host ambiance. JDBC provides a comprehensive SQL database access mechanism that offers a dependable interface to a variety of RDBMSs. This consistent interface is gained through the use of “plug-in” database connectivity modules, or drivers. If a database vendor chooses to have JDBC support, he or she must provide the driver for each platform that the database and Java can use to run the application.
To gain a wider acceptance of JDBC, Sun based JDBC’s framework on ODBC. As you discovered earlier in this chapter, ODBC has widespread support on a variety of platforms. Basing JDBC on ODBC will allow vendors to bring JDBC drivers to market much faster than developing a completely new connectivity solution.
JDBC was announced in March of 1996. It was released for a 90 day public review that ended June 8, 1996. Because of user input, the final JDBC v1.0 specification was released soon after. The remainder of this section will cover enough information about JDBC for you to know what it is about and how to use it effectively. This is by no means a complete overview of JDBC. That would fill an entire book.
JDBC concedes multiple applications to exist and to be used by the same application. To support this, API allows a mechanism for dynamically filling the reliable Java packages, followed by registering them with the driver manager of JDBC. Driver manager acts as a connection factory for developing different connections of JDBC.
There are different sets of drivers for JDBC, which are client-side adapters, which is already equipped on to client system, and not on the server. These drivers then convert the requests from Java programs to a detailed protocol that can be easily understood by Data-Base management system (DBMS). These drivers of JDBC are further classified into commercial and free drivers that are easily applicable for most of the relational database servers. The drivers usually fall into one among these types:
Type 1 – which calls the native code of locally available ODBC driver.