Servlets and databases Assignment Help

Assignment Help: >> Servlets >> Servlets and databases

Servlets and databases:

Applets can, as we have seen, 'phone home' to access stored data on the server from which they were downloaded, but cannot normally access the file system on the client system where they execute. One of the advantages of servlets over standard applets is that servlets can access stored data on the local server or on any linked computer. This is often most conveniently handled by having a servlet access information stored in a database, as shown in Figure.

For example, in the lottery example above, the log in process really should access stored details of the user name and password to ensure a valid log in. It would also be useful to allow a lottery player to enter their chosen lottery numbers and store these in a database, to be checked later against the winning numbers. Figure shows how Java programs, including servlets, can access a range of standard database systems using the technology known as JDBC.

2295_servlt and database.png

Figure: How Java applications or servlets access a database

You might have thought that JDBC stands for something like Java Database Connectivity, but it officially stands for JDBCTM , according to Sun Microsystems. JDBC is a set of classes, structured into packages, that provides an API for accessing databases from Java programs. It has the advantage that it works with a variety of databases, and it is even possible to change the database used by a JDBC-based Java program without changing the Java source code. A software component known as a JDBC driver provides the interface between the Java program and the database management system (DBMS). The JDBC driver for a specific DBMS, such as Oracle or Access, communicates with the DBMS in the specific language required by that DBMS. The DBMS may be on the same computer or running on a separate server from the Java program and on a completely different platform - it makes no difference, except perhaps to the speed of response if the database server is on a distant or slow communications link.

The details of JDBC are outside the scope of this course. However, we can follow the broad outline of how it works. Servlets construct database queries by invoking Java methods from the JDBC API. These generate SQL queries and send the queries to a database management system. SQL (Standard Query Language) is used to request or modify data stored by database management systems, and is standard in that it is implemented by all major database products. SQL is not so standard because particular database manufacturers tend to add their own variants and extensions to the standard language. Each DBMS may also differ in the types of data it can conveniently handle, such as integers, decimal numbers, dates, times or money. Hence, there is a need for a JDBC driver specific to each particular DBMS. JDBC also deals with receiving the data returned by the DBMS and packaging it for retrieval by the Java program that requested it. The data is normally returned as a result object from a method invocation.

When writing servlets to access a database, it is normally useful to override the init method to set up access to the database, and to release the link to the database using the destroy method, just before the servlet terminates.

Incidentally, communication that is intended to be secure against corruption or interception normally uses a more secure protocol than standard HTTP, such as the HTTPS protocol (HTTP Secure). This would be essential, for example, where financial information such as a credit card number is to be transmitted.

 

Java Assignment Help - Java Homework Help

Struggling with java programming language? Are you not finding solution for your Servlets and databases homework and assignments? Live Servlets and databases experts are working for students by solving their doubts & questions during their course studies and training program. We at Expertsmind.com offer Servlets and databases homework help, java assignment help and Servlets and databases projects help anytime from anywhere for 24x7 hours. Computer science programming assignments help making life easy for students.

Why Expertsmind for assignment help

  1. Higher degree holder and experienced experts network
  2. Punctuality and responsibility of work
  3. Quality solution with 100% plagiarism free answers
  4. Time on Delivery
  5. Privacy of information and details
  6. Excellence in solving java programming language queries in excels and word format.
  7. Best tutoring assistance 24x7 hours

 

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd