JDBC is a front-end tool for linking to a waiter and is similar to ODBC nevertheless, JDBC can link merely Java client and it uses ODBC for the connectivity. JDBC is basically a low degree application programming interface. It is called a low degree API since any informations use, storage and retrieval has to be done by the plan itself. Some tools that Provide a higher degree of abstraction is expected shortly.
The following inquiry is why we need JDBC, one time we have ODBC on manus. We can utilize the ODBC to link to all the databases and ODBC is a proved engineering. Problem for making this is ODBC gives a ‘C ‘ linguistic communication API, which uses arrow extensively, since Java unfastened JDBC to accommodate its demands.
Jdbc Driver Tipes
There are assorted types of driver, identified the Sun such that each one has some alone characteristics and facilitates a connexion to the database.
JDBC drivers fit into of four classs:
The JDBC-ODBC span provides JDBC entree via most ODBC drivers. Note that some ODBC binary codification and in may instances database client codification must be loaded on each client machine that uses this frogman so this sort of driver is most application on a corporate web or for application waiter codification written in Java in a 3-tier architecture.
A native-API partly-Java driver converts JDBC calls into on the client API for Oracle Sybase Informix DB2 or other DBMS. Note that, like the span driver this manner of driver requires that some binary codification be loaded on each client machine.
A net-protocol all-Java driver translates JDBC calls into a DBMS-independent cyberspace protocol which is so translated, to a DBMS protocol by a waiter. This net waiter center cognizant is able to link its all Java client to many different databases. The specific protocol used depends on the seller. In general this is the most flexible JDBC option. It is likely that all sellers of this solution will supply suited for intranet demands for security, entree through firewalls, etc. that the web imposes several sellers are adding JDBC drivers to their bing database middle cognizant merchandises.
A native protocol driver
JDBC architecture is as follows
JDBC Driver Manager
JDBC Driver Manager
Function of the driver director is to happen out available driver in the system and link the application to the appropriate database, whenever a connexion is requested. However, to assist the driver director place different types of drivers, each driver should be registered with the driver director.
Function of the JDBC driver is to accept the SQL calls from the application and change over them into native calls to the database, . However, in this procedure it may take aid from some other drivers or even waiters, which depends on the type of JDBC driver we are utilizing. It besides is possible that the entire functionally of the database waiter could be built into the driver itself.
JDBC – ODBC Bridge:
Sun soft provides a particular JDBC Driver called JDBC-ODBC span which can be used to link any bing database, that is ODBC ailment.
Servlet and JSP engineering has become the engineering of pick for developing on-line shops, synergistic Web applications, and other dynamic Web sites. Why? This chapter gives a high-ranking overview of the grounds for its popularity. Later chapters specific inside informations on programming techniques.
A Servlet ‘s Job
Servlet or Java plans which run on application waiters, acts as in-between bed among the petitions coming from http clients or web browsers and database or applications on hypertext transfer protocol waiter. Their occupation is to execute the undermentioned undertakings.
Reading the usage full information that is sent by the client.
The users by and large enter this information in hypertext transfer protocol from a web page. Even the informations can besides be expected to come from an applet or usage http client plan. Chapter 4 discusses how servlet read this informations.
Reading HTTP petitions sent by the browser.
The shows a individual pointer traveling from the client to the web waiter ( the bed where servlets and JSP execute ) , but really there are two types of informations: the informations that the user enters in a signifier and the behind-the -scenes HTTP information. Both assortments are critical. The HTTP information includes cookies, information about media types and compaction schemes the browser understands and so forth it is discussed in chapter 5.
Geting the consequences.
This procedure is needed for, database to reach, to do an RMI or EJB call, to raise a web service or working on replied information which is in a relational database. But the database may non run on hypertext transfer protocol or return consequences in hypertext markup language, so that the web browser can non straight cover with the database. Even if it could, for security grounds, you likely would non desire it to.
This statement even can use for other applications, so we need the in-between bed to acquire the geting informations from hypertext transfer protocol watercourse for the applications to infix the consequences in the papers.
Sending the utile informations to the clients:
The papers can direct in different formats like ( XML OR HTML ) , binary ( GIF images ) , or in nothing files that is layered on top of other implicit in format. Though HTML is a common format, servlet /JSP undertaking is to cover the consequences of HTML.
Send the inexplicit HTTP response informations.
The shows a individual pointer traveling from the web in-between bed ( the servlet or JSP page ) to the client.But there are two types of informations sent the papers entirely and last the scenes HTTP information. But these two types can impact the development, by directing the HTTP informations to the waiter or by puting cookies and hoarding parametric quantity and others.
Features of JSP
JSP provides an attractive option to other dynamic scripting linguistic communication by offering the undermentioned characteristics:
The usage of adds versatility to a web application by enabling its executing on any computing machine.
Enhanced public presentation:
The digest procedure in JSP produces faster consequences or end product.
Separation of logic from show:
The usage of JSP permits the HTML-specific inactive content and a mixture of HTML, Java, and JSP-specific dynamic content to be placed in separate fillies.
Ease of disposal
The usage of JSP eliminates the demand for high-ranking proficient expertness, thereby assisting web developers, content Godheads, and content directors to work together and develop Java-based applications in less clip and with less attempt.
Ease of usage:
All JSP applications run on major web waiter and runing systems, including Microsoft IIS, Netscape endeavor waiter, I Planet web waiter, and Apache web waiter. These applications are available on Windows NT, windows 2000, and solaris7.
Competing Merchandises across Platforms:
Competing merchandises include active waiter pages ( ASP ) , hypertext pre processor ( PKP ) and Java book.
JSP versus ASP:
ASP is the immediate viing engineering from Microsoft. The dynamic content of JSP is written in Java, in contrast to that of ASP, which is written utilizing an ASP-specific linguistic communication, such as VBScript. As a consequence, complex applications can utilize the power of Java to ensue and implant Java constituents in JSP applications, 2nd, JSP is portable to other runing systems and waiters in contrast to the commitment of ASP to Windowss NT/2000and IIS.
JSP versus PHP:
PHP is similar to ASP and JSP to a certain extent. PHP is a free, open-source, HTML-embedded, server-side scripting linguistic communication, with basic HTML cognition, nevertheless, a VBScript coder can compose ASP applications and a Java coder can make JSP applications, whereas PHP requires larning an wholly new linguistic communication, 2nd by virtuousness if the power of Java, JSP has entree to an extended API for networking, database entree, and objects distribution.
JSP Objects & A ; its Scopes
In JSP there are two types of objects.
Implicit objects are automatically created.
Explicit objects are created utilizing actions.
Whenever a petition has been made for a JSP PAGE, JSP page will make two types of objects. They are:
Implicit objects are automatically created by the JSP web developers can utilize this objects for their processing.
Explicit objects are created thought actions. Scripting codification is used to make these expressed objects. Every explicit object has some seeable property. Scripting elements can entree the expressed objects thought scripting-level variables.
JSP defines several Scopess for JSP objects.
JSP defines several Scopess for objects. Scopes are used to bespeak the context in which the bean should be made available.
Four types of Scopess. They are:
While procedure the petition, the JSP page can make and /or the some Java objects.
Scopes are used to bespeak the context in which the dean should be made available in JSP there are four Scopess are available. They are:
It is the default Scopess for all the Java objects. It is used to bespeak that the objects are merely available on the current page. Once the response is sent back or the petition is forwarded someplace else all the object mention, which has the page range, will be released object that contains
Page range is stored in the page Content object of the current page.
The petition range is used to bespeak that the objects are merely available for the current client petition. If the petition is forwarded to a resource in the same runtime, the Object is still available. Once the petition is processed, all the object mention, which has the petition range, will be released. Objects that contain request range will be released. Object mentions that contain request range are stored in the petition Object.
The session range indicates that the available to all pages during the life of the current session. All mentions to the objects shall be released after the associated session ends. Mentions to objects with session range are stored in the session objects associated with the page activation.
The application range indicates that it is available to all pages that portion the same context object mentions which contain the application range will be released when the runtime environment reclaims the servlet context objects mentions that contain the application range are stored are stored in the application objects associated with the page activation.
Directives And Actions:
JSP elements can be directives or actions. Directives elements supply planetary information for the interlingual rendition stage. Actions elements provide for the request-processing stage. New action can be created from the ticket extension mechanism.
Elementss can be directives or actions. Directing elements are used to supply planetary information, which is non dependent for any specific received by the JSP page. For illustration directing elements can be used to include the external file inside the JSP PAGE.
Action elements provide information, which is dependent on the inside informations of the specific petition received by the JSP page.
Directing elements provide information for the compilation/translation stage.
Action can make some objects and may do available to the scripting component. Action elements follow the sentence structure of XML elements.
JSP contains a tag extension mechanism that enables the add-on of new actions. Because of the mechanism JSP can b easy portable. Actions can be customized to supply entree to the property values and to their organic structure. Custom action be nested and their organic structures can include scripting elements.
Two distinguishable ways to entree ODBC informations beginnings with DAO the Microsoft Jet database engine DBC direct Microsoft jet provides a wide scope of functionality. It handles many of the inside informations of set uping and pull offing connexion, interpreting questions into a signifier acceptable to the waiter, and pull offing returned informations in some instances, if you want to short-circuit the micro soft Jet database engine and usage DAO to do calls straight to the ODBC driver director. This functionality is available through ODBC Direct.
The undermentioned stairss offer a “ speedy start ” to accessing ODBC informations:
Use the ODBC informations beginning director in the Windowss control panel to setup your ODBC information beginning and delegate it a information
Beginning name ( DSN )
In your Ocular Basic codification, set an ODBC connect twine that references the information beginning. The connect twine is used to set up a connexion to the informations beginning
Make a new tabular array def object and set it ‘s connect twine to the value specified in measure two.
Append the tabular array to the tabular array defs aggregation
Open a record-set object on the linked tabular array. This record-set
7. Object contains informations in your OBDC information beginning and you can pull strings it utilizing the belongingss and methods of a record-set object.