< Diff . B/w c++ and JAVA < JDK(Java Development Kit) < JVM(Java Virtual Machine) < JDBC(Java DataBase Connectivity) 2 < James Gosling initiated the Java language project in June 1991 for use in one of his many set-top box projects. < Break platform dependencies of c and c++. < mplementing object oriented programming methodology containing built in support for the use of computer networks, the ability to execute remote sources of code in a secure fashion. 3 < 1991 Sun Microsystems initiates project "Greenwith the intent to develop a programming language for digitally controlled consumer devices and computers. < The language OAK was developed by James Gosling with the goal of using C++'s popularity but without many of the annoying features. 4 < Sun released the first public implementation as Java 1.0 in 1995. < 13 November 2006, Sun released much of Java as free and open source software under the terms of the GNU General Public License (GPL). < On 8 May 2007 Sun finished the process, making all of Java's core code free and open- source 5 < Design goals: Object oriented language. Allow an automatic garbage collection Mechanism Security Threading support Easily portable on any environment and devices. 6 Java is a : < Simple < Object oriented < Distributed < Secure < Architecture Neutral < Portable < High Performance Language. 7 8 9 10 11 12 13 14 15 C++ Java Can Have a Stand alone Functions All methods are part of a class Can Have a Global Variable No Global Variable is there Multiple nheritance No Multiple nheritance Operator overloading No Operator overloading besides "+ No Automatic Garbage Collection Automatic Garbage Collection Heavy Reliance on Preprocessor No Preprocessor 16 C++ JAVA Supports Union and Structs . Does not Supports these. Supports typedef,enum (user define data type) . Doesn't supports typedef,enum. Supports Constant variable Supports Final variable. 17 < The JDK provides all the necessary components for developing a java program. < The JVM (java), java compiler (javac), javadoc, jar utility and many more are part of the JDK. 18 19 < A Java compiler is a program which converts Java source code into Java bytecode. < A basic Java compiler is included as part of the JDK (Java Development Kit). This Java compiler is called "javac". A Java decompiler is a special type of decompiler which takes a class file as input and produces Java source code as output. Java DecompiIers: "Jode" < The Jode Java decompiler reads in class files and produces something similar to the original java file. Of course this can't be perfect: There is no way to produce the comments or the names of local variables. < The JRE is the Java Runtime Environment. < The JRE consists of the Java Virtual Machine, the Java libraries, and all other components necessary to run Java applications and applets. < Sun distributes the JRE seperately. < t is a piece of software that enables Java technology to be recognized and successfully executed on a vast array of hardware platforms. < Java virtual machines are so named because they provide a necessary environment for the Java bytecode to be executed. < The flexibility of a JVM allows a Java applet to be written only once, but able to be run on virtually any operating system. *Sun distributes the JVM as part of the JRE. < JRE includes (JVM ) java virtual machine and some other library files. That runs a java application. < JVM - understand the corresponding byte code of a java class and make it ready for run. < The Java Runtime Environment (JRE) is an implementation of the JVM (Java Virtual Machine) that actually executes our java programs. < JDBC is JAVA DataBase Connectivity. < JDBC is an interface which allows Java code to execute SQL statements inside relational databases the databases must follow the ANS SQL-2 standard < JDBC library is implemented in the java.sql package Set of classes and interfaces that provide a uniform AP for access to broad range of databases 25 < A JDBC based application is insulated from the characteristics of specific database engines Java AppIication JDBC Access Database OracIe Database Sybase Database 26 27 < JDBC AP < JDBC Driver Manager < JDBC Test Suite < JDBC-ODBC Bridge 28 < t Provide Access To Relational Data from the JAVA Programming Language. < Using it Applications can execute SQL Statements and Retrieve Results. < JDBC 4.0 AP is divided in to packages: Java.sql Javax.sql 29 < JDBC DriverManager class define objects which connect java application to JDBC driver. < DriverManager has been the back bone of JDBC Architecture. 30 < Used to determine that JDBC drivers will run Program properly or not. 31 < Bridge provides JDBC access via ODBC drivers. < ODBC (Open Database Connectivity) is a Microsoft standard from the mid 1990's. < t is an AP that allows C/C++ programs to execute SQL inside databases < ODBC is supported by many products. 4393:0/ 32 < The JDBC-ODBC bridge allows Java code to use the C/C++ interface of ODBC it means that JDBC can access many different database products < The layers of translation (Java --> C --> SQL) can slow down execution. 4393:0/ 33 < The JDBC-ODBC bridge comes 1700 with the JDK: called sun.jdbc.odbc.JdbcJdbcDriver < The ODBC driver for Microsoft Access comes with MS Office so it is easy to connect Java and Access 34 < JDBC-ODBC Bridge, plus ODBC driver (Type1) < Native-AP, partly Java driver (Type 2) < JDBC-net, pure Java driver (Type 3) < Native-protocol, pure Java driver (Type 4) 35 < This driver type is provided by Sun with JDK < These are Depend on Native Library, which limits there portability. < JDBC-ODBC Bridge Driver is example of type1 driver. AppIication Space Java AppIication JDBC - ODBC Bridge Database SQL Command ResuIt Set ODBC Driver Proprietary ProtocoI 36 < Half written in java and half in native code(c ,c++). < Due to native code their portability is limited. < Directly interfaces with the database AppIication Space Java AppIication Type 2 JDBC Driver Database SQL Command ResuIt Set Native Database Library Proprietary ProtocoI 37 < &se pure Java CIient and communicate with middIeware server using database independent protocoI. < MiddIeware then communicate with cIient's request to data source. AppIication Space Java AppIication Type 3 JDBC Driver Database SQL Command ResuIt Set MiddIeware Space Proprietary ProtocoI JDBC Driver 38 < Pure Java drivers that communicate directIy with the database. < Advantage: no additionaI transIation or middIeware Iayer Improves performance AppIication Space Java AppIication Type 4 JDBC Driver Database SQL Command &sing Proprietary ProtocoI ResuIt Set &sing Proprietary ProtocoI 39 Driver Driver Manager Connection Statement Result Set 1. Load the 1DBC driver class: Class.forName(~driverName); 2. Open a database connection: DriverManager.getConnection (~jdbc:xxx:datasource); 3. Issue SQL statements: stmt con.createStatement(); stmt.executeQuery (~Select ` from myTable); 4. Process result set: while (rs.next()) name rs.getString(~name); amount rs.getInt(~amt); ] Database 40 < JBDC AP Supports : Two Tier Architecture for Data Access Three - Tier Architecture for Data Access 41 < Java Application talks directly to the database . < Accomplished through the JDBC driver which sends commands directly to the database . < Results sent back directly to the application . CIient Machine Java AppIication JDBC Driver Database SQL Command ResuIt Set 42 < JDBC driver sends commands to a middIe tier, which in turn sends commands to database. < ResuIts are sent back to the middIe tier, which communicates them back to the appIication. < Maintain controI over access & updation on data CIient Machine Java AppIication Database server SQL Command ResuIt Set AppIication Server (middIe-tier) Proprietary ProtocoI 43 JDBC Coded in C,C++ < Java is used in many facets: from the digital displays on your microwaves refrigerators in your kitchen digital displays on your telephones, fax machines, and copiers in your office. t is used on the web (via applets) for entertainment, research. other miscellaneous functions, like a website spell checker that will automatically go through your website, click each link, and spell check every page. 44 45