Wednesday, June 3, 2015

JDBC RowSets

In J2SE 1.5, there are five new RowSet objects implemented.

CachedRowSet and WebRowSet are the most valuable on that.

The RowSet objects, unlike ResultSet objects, can operate without always being connected to a database or other data source. Without the expensive overhead of maintaining a connection to a datasource, they are much more lightweight than a ResultSet Object.

The CachedRowSet contains an in-memory collection of rows retrieved from the database that can, if needed, be synchronized at a later point in time.

The WebRowSet implementation, in addition, can write and read the RowSet in XML format.

Features of all Java Versions


* J2SE Version 8
  • Lambda Expressions
  • Pipelines and Streams
  • Date and Time API
  • Default Methods
  • Type Annotations
  • Nashhorn JavaScript Engine
  • Concurrent Accumulators
  • Parallel operations
  • PermGen Error Removed
  • TLS SNI

* J2SE Version 7
  • String in switch statement
  • Binary Literals
  • The try-with-resources
  • Caching Multiple Exceptions by single catch 
  • Underscores in Numeric Literals 
  •  Diamond Syntax

* J2SE Version 6

    * Pluggable Annotation Processing API
    * Common Annotations
    * Java API for XML Based Web Services - 2.0
    * JAXB 2.0
    * Web Services Metadata
    * Streaming API for XML
    * XML Digital Signature
    * Java Class File Specification Update
    * Java Compiler API
    * JDBC 4.0
    * Scripting in the Java Platform

* J2SE Version 5
  • Generics
  • Enhanced for Loop
  • Autoboxing/Unboxing
  • Typesafe Enums
  • Varargs
  • Static Import
  • Metadata (Annotations)
  • Instrumentation

* J2SE Version 1.4
  • XML Processing
  • Java Print Service
  • Logging API
  • Java Web Start
  • JDBC 3.0 API
  • Assertions
  • Preferences API
  • Chained Exception
  • IPv6 Support
  • Regular Expressions
  • Image I/O API

* J2SE Version 1.3
  • Java Sound
  • Jar Indexing
  • Performance enhancements including the Hotspot virtual machine. 

* J2SE Version 1.2, also called the Java 2 Platform
  • Collections framework.
  • Java String memory map for constants.
  • Just In Time (JIT) compiler.
  • Jar Signer for signing Java ARchive (JAR) files.
  • Policy Tool for granting access to system resources.
  • Java Foundation Classes (JFC) which consists of Swing 1.0, Drag and Drop, and Java 2D class libraries.
  • Java Plug-in
  • Scrollable result sets, BLOB, CLOB, batch update, user-defined types in JDBC.
  • Audio support in Applets

* JDK Version 1.1 :
  • JDBC (Java Database Connectivity)
  • Inner Classes
  • Java Beans
  • RMI (Remote Method Invocation)
  • Reflection (introspection only)
  • Improvements include better event handling, inner classes, improved JVM

* JDK Version 1.0 :

    * Netscape 2.0-4.0 included Java 1.0.
    * Microsoft and other companies licensed Java.


Design Document

Why Do We Write A Design Document?
 
A design document will be written by software developers and given to a software development team for the guidance of architecture of the software project.
Before starting coding of a project, the project objective needs to be understood.
So the Design document is to write down an outline of a course of development, or, in other words, a description of a software product.

It generally describes the modules, learning assessment method, and source content.

Elements of Design Document:
  1. Introduction
  2. Design Considerations
  3. Architecture
  4. System Architecture
  5. Detailed System Design
  6. Glossary
  7. Bibliography
Structure of Design Document:
1 Introduction
2 Design History
3 Document Description
    3.1 Overview
    3.2 System Overview
    3.3 Design Considerations
         3.3.1 Assumptions and Dependencies
         3.3.4 Goals and Guidelines
         3.3.5 Development Methods
    3.4 Architectural Strategies
    3.5 System Architecture
    3.6 Detailed System Design
    3.7 Glossary
    3.8 Bibliography
4 Appendix

Class Data Sharing in J2SE 1.5

Class Data Sharing

Class Data Sharing is a new feature in Java 1.5. It is used to reduce the start up time for Java applications.
When the JRE is installed on a 32-bit platform using the Sun-provided installer, the installer loads a set of classes from the System jar file into a private internal representation, and dumps that representation to a file, called a "shared archive".
In J2SE1.5, class data sharing is supported only with the Java HotSpot Client VM, and only with the serial garbage collector.
The primary motivation for including Class Data Sharing in the 5.0 release is the decrease in startup time it provides. CDS produces better results for smaller applications because it eliminates a fixed cost: that of loading certain core classes. The smaller the application relative to the number of core classes it uses, the larger the saved fraction of startup time.

JavaServer Page

JavaServer Pages, or JSP, is a technology that allows developers to generate HTML and XML in response to a web client request.

JSP allows Java code and various predefined actions to be embedded into static content. JSP actions are additional XML tags that help extend the capabilities of a Web server.

The main features of JSP:

1. A language for developing JSP pages, which are text-based documents that describe how to process a request and construct a response.
2. An expression language for accessing server-side objects.
3. Mechanisms for defining extensions to the JSP language
.
Descriptions:

Jsp is a text-based Document which is used to create the dynamic web contents. and it is the extensions of Servlet.

Basically, JSPs are HTML files with embedded Java servlet code.

Each block of servlet code is surrounded by a leading '<%' tag and a closing %> tag.

Similar to servlets, they can do much more complicated work based on data submitted by the client.

To make the manipulation convenient, a scriptlet can use a number of predefined variables.

The six most frequently used variables are:

1. HttpServletRequest request --- The Servlet Request

2. HttpServletResponse response --- Servlet Response

3. javax.servlet.jsp.JspWriter out --- like a PrintWriter

4. HttpSession session --- User session

5. ServletContext application --- The Web application

6. javax.servlet.jsp.PageContext pageContext --- share the variables between jsp pages and supporting beans, tags

JSP may include the servlet code in the following formats.

i. Expressions
ii. Declarations
iii. Scriptlets
iv. Directives

Java Memory Leaks

Java memory Leaks can occur in the following ways:
  1. Saving an Object reference in to class level collection and forgetting to remove it at the proper time.
  2. Not Closing the JDBC Statement/ResultSets in a finally block.
  3. In native code, the Programmer forgetting to free a memory block.
To determine if the memory leak is caused by a Java memory leak, you should monitor the Java memory used.
The following code can be used to do this in the application:
System.out.println(“Java memory in use = “ + Runtime.getRuntime().totalMemory() –
        Runtime.getRuntime().freeMemory() );

Java Features

Important Features Of Java:
01. Platform Independence.
02. Object Oriented.
03. Compiler/Interpreter
04. Robust.
05. Security
06. Automatic Memory Management
07. Dynamic Binding
08. Good Performance
09. Threading
10. Built in Networking