Professional Documents
Culture Documents
=>JDBC:- Java DataBase Connectivity is a specification given in the form of Abstraction API
to achieve loose coupling between java application & database server.
* The backbone of API is Abstraction.
* The o/p of abstraction is loose coupling which can be achieved with the help of interface.
=>Loose Coupling:- Change in the implementation which doesnot effect the user is known as
loose coupling.
=>Interface:- It is a media to communicate between user & any device.
=>Abstraction:- Hidding the implementations & providing the functionalities to the user with the
help of interface is known as abstraction.
=>Q. Why are the implementations hidden in case of abstraction?
Ans. To reduce the complexity or to make the implementations look simple and neat for the user.
=>Q.(M.I.) Why is a class made abstract when it contains only concrete methods in it?
Ans. So that further enhancements or modifications made doesnot effect the user.
Ex. Any new upgradations made to an existing applications or installations of new
application.
Ex. Loose Coupling=>Change in application(which doesnot effect the user).
Tight Coupling=>Change in ATM PIN(which effects the user).
=>Steps of JDBC
There are 6 different steps present in jdbc namely.
1. Load & Register the Driver
Load & Register the Driver=>Driver Class=>Respective DBS/Vendors=>JAR
* Respective DBS/Vendors
Respective DBS/Vendors Driver Class Port Number
=> Oracle => OracleDriver => 1521
=> MySQL => Driver => 3306
=> (Microsoft)MSsql => SqlServerDriver => 1433
=> Derby => EmbeddedDriver => 1527
Load & Register the Driver
=> Whenever n number of initParameter or n no of context parameters are declared then we use
getInitParameterNames().
=> (V.V.V.Imp.) Request(req) => Datas present in request object are UI/Form data.
|
Fetched => getParameter() => req.getParameter(key);
Scope of request object is throughout the application.
=> (V.V.V.Imp.) config => Datas present in config object are init/initialisation parameters.
|
Fetched => getInitParameter() => config.getInitParameter(key);
Scope of config object is limited to that particular servlet object.
=> (V.V.V.Imp.) context => Datas present in context object are context parameters & attributes.
|
Fetched => getInitParameter() => context.getInitParameter(key);
Scope of context object is throughout the application.
=> Parameter:- Data in the form of key & value pair where key must be unique string and value
can also be a string.
=> Attribute:- Data in the form of key & value pair where key must be a unique string and value
can be any object.
=> (V.V.Imp.) To add any object into scope, we use setAttribute().
+ void setAttribute(String key,Object obj);
=> To fetch any object back from the scope, we use getAttribute();
+ Object getAttribute(String key);
=> Q. (M.M.Imp.) What is JSP?
Ans. JSP is known as High Level Abstraction of Servlet that means the translation or conversion of
a JSP into a Servlet by the JEE container for first client request.
=> Q. (M.M.Imp.) Specifications of JSP
Ans. There are three specifications present for JSP namely
1. By Default, JSP extends HTTP.
2. By Default, all translated servlets extends a class called HTTP JSP Base.
3. By Default, all translated servlets are stored in work folder of Apache Tomcat Server.
=> Scriptlet:- Area to write Java Codes on a JSP file.
=> Expression:- Used to represent or print Java Codes(Output).
=> Q. (M.M.M.Imp.) Implicit Objects of JSP
Ans. There are 9 implicit objects present in JSP namely.
1. Request 4. Session 7. Out
2. Response 5. Application 8. Exception
3. Config 6. Page 9. Page Context
=> (M.M.M.Imp.) The default scope of JSP is page.
=> (M.M.Imp.) Criteria for JSP
* There are 3 criterias present for JSP namely.
1. We cannot write one JSP element inside another JSP element.
2. We cannot write any HTML code inside the JSP element.
3. We can write any JSP element for any no. of times.
=> (M.M.M.Imp.) By Default, JSP is also MultiThreaded but it can be made Single Threaded.
<%@ Page is Thread Safe =”False” %>
=> Q. Why is JSP used instead of HTML to give presentation logic?
Ans. JSP is used instead of HTML for two reasons
1. Since JSP is Dynamic resource.
2. Is Code Simplification.
=> MetaData
* Data about the data is known as MetaData.
Ex.- Variables, ColumnNames, TableNames
* There are two types of metadata present namely.
1. Database MetaData=> Used to deal with DB whenever there is lack of information w.r.t. DB.
2. ResultSet MetaData=> Used to deal with tables whenever there is lack of information w.r.t. the
datas present in the table.