Java

Java is an object-oriented programming language developed by Sun Microsystems in 1991 and first released in 1995. Its development was led by the “Green Team”, managed by the flagship programmer James Gosling. In the beginning was to be called “Oak”, and there are many theories of why this name, being the most accepted the fact that there was an oak tree (Oak in English) against the Green Team office. That name turned out to be little commercial locations, apart from already having been registered. Finally, at the offices of Sun, it was decided to call it Java.

Java does not take long to reach the hearts of desktop programmers, providing a platform multiplatform and robust for developers. In its beginnings left much to be desired in the graphical interface, because the original graphics library, AWT (Abstract Window Toolkit), was much attached to the operating system and engaged in targeted bugs, that is to say, bugs specific to each operating system.

However, the biggest market of Java now is aimed at server applications, offering in the platform J2EE a wide range of tools to develop secure systems, scalable and robust.

Java, rather than a programming language, was developed considering a technology or framework. 

J2ME: Java Micro Edition, destined for develop mobile applications. It is developed considering the limited resources that have a mobile device.

J2SE: Java Standard Edition, for the world of desktop applications. It is the core of the language; containing the base of the API (Application Programming Interface) this offers us.

J2EE: Java Enterprise Edition, for the systems business. It is built on J2SE, but with the addition of a large security API, giving the developer all the tools necessary.

Java, like any programming language object-oriented, depends on Classes and Objects. A class is nothing more than a template from which an object is created. But once again, this can only be understood by a technical user. In plain words, a class is a blueprint from which it is possible to construct a building.

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.

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.

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.

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.

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.

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.

Like human languages, programming languages have different levels of writing difficulty; some are easy to write, while others require extensive computer knowledge to understand. In programming, high-level languages are easier to understand, learn and write because of the use of natural language. But, as the use of natural language decreases and more words and computer statements are added, the difficulty level of language increases. This process eventually stops when we get to the lowest level of programming languages, machine language or Assembly language. This language strictly deals with solving problems using hardware, thus, requiring extensive knowledge of hardware and well as software to effectively write programs.

Since Java is so widely used in the world, its impact on the economy is large for a software language. “Sun estimates the total Java Economy to be more than (USD) $100 billion in sales annually driving an additional $110 billion in related IT spending” (Sun). Adding that up, Java’s economic impact compares to about 1.4% of the U.S. $14 trillion economy. Splitting the total value up, “The Java economy includes 2.5 billion smart cards, 800 million PCs shipped with Java, 1.85 billion Java Powered phones (source: Ovum), and over 180 telecom providers who deploy Java technology based content/services” (Sun).

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.

Categories: News