Sunday, 7 December 2014

How you define web service protocol stack?

How you define web service protocol stack?

The entire stack has four layers

Service Transport,

The Service Transport layer transfer messages between different applications, such as HTTP, SMTP, FTP, and Blocks Extensible Exchange Protocol (BEEP).


XML Messaging,

The XML Messaging layer encodes messages in XML format so that messages can be understood at each end, such as XML-RPC and SOAP.


Service Description

The Service Description layer describes the user interface to a web service, such as WSDL.


Service Discovery.

The Service Discovery layer centralizes services to a common registry and offer simple publish functionality, such as UDDI.

Define XML – RPC?
It is a protocol that makes use of XML messages to do Remote Procedure Calls.


JMS and ActiveMQ

Sprint JMS and ActiveMQ
=======================
Ascronise message services 

JMS can be configured in two ways :- 
1.publich and subscriber
2.point to point model

http://icodingclub.blogspot.in/2011/07/introduction-of-spring-jms-with.html


JMS --
java messaging services 
client -- sender of message
Message hit that is MOM(message oriented middle ware) server it gets to the receiver from the mom server


RMI is a syncronize message
JMS is used to asyncronize message (no direct contact to sender to receiver means sender do not care to know the receiver receive the message or not)

DO -- destnation object


there are two typer os model for JMS
====================================


1.publischer and subscriber
2.point to point

in case of public subscriver the destination object is know as TOPIC
in case of point to point the destinatin object is know as Queue

BOTH the sender and receiver are the client to JMS
There are different type of messages can be send out here

Lets look out the difference between the 
Publish subscriber vs point to point
====================================
in case of public subscriber model, we have n number of sender sending messages to destination object (DO) 

its some thing brodcasting

where as point to point



=====================
there are 5 types of messages can be send my JMS
1.Text message
2.MAP message
3.String
4.Object
5.Byte message

====================
How this message difference the eMAIL
====================
Where do we should use JMS application
CRM,Inventry system. 
====================

JMS a Specification

need a factory object to send message
====================
JNDI to regiser the objects

JMS Specification
=================
did not said about security,factory object.
================
1.Fast context of JNDI ... fetch the JNDI context
2.Lookup for the connection factory, when i m looking for connection factory here , depending on here which modle i have been using here, either topic connection factory or Quck connection factory.
3.Using the factory object create the connection.
  need to open the connection so that we can send the message.
4.Session , create a session object using the connection object, when u create the session object
need to pass two parameeter
by passing 
a.transated or not -- boolean value
b.acknolodege type -- three type 1. Auto, 2.Client , 3.Dups OK

   Difference between three type ACKs
   By defeault Auto acks, once the msg send auto metic come to MOM server
  Clien acks is when u have to call 
  Dups ok acks it says its ok if i recive msg more then once

5.Once get session need to look for the DO (destination object) from the JNDI, thas the topic or Queq

6.Create a sender or publice, or recver or subscrive

7. For the Sender

8.Creater a publiscrer   


Saturday, 24 May 2014

SQL Query


SQL Query to find second highest salary of Employee

select MAX(Salary) from Employee WHERE Salary NOT IN (select MAX(Salary) from Employee );



SQL Query to find Max Salary from each department.


SELECT DeptID, MAX(Salary) FROM Employee GROUP BY DeptID.



Write a SQL Query to print the name of distinct  employee whose DOB is between 01/01/1960 to 31/12/1975.

SELECT DISTINCT EmpName FROM Employees WHERE DOB BETWEEN ‘01/01/1960’ AND ‘31/12/1975’;




Write an SQL Query to find employee whose Salary is equal or greater than 10000.

SELECT EmpName FROM Employees WHERE Salary>=10000;



Write an SQL Query to find name of employee whose name Start with ‘M’

SELECT * FROM Employees WHERE EmpName like 'M%';





Find all Employee records containing the word "Joe", regardless of whether it was stored as JOE, Joe, or
joe.


SELECT * from Employees WHERE upper(EmpName) like upper('joe%');





Finding nth highest salary example

SELECT *
FROM Employee Emp1
WHERE (1) = (
SELECT COUNT(DISTINCT(Emp2.Salary))
FROM Employee Emp2

WHERE Emp2.Salary > Emp1.Salary)


Delete multiple duplicate rows ?
OR
How to Delete Duplicate Records in Oracle ?



DELETE FROM your_table
WHERE rowid not in
(SELECT MIN(rowid)
FROM your_table
GROUP BY column1, column2, column3);


delete from emp a where rowid != (select max(rowid) from emp b where  a.empno=b.empno);


Sunday, 18 May 2014

Explain the use of the Join keyword and its various types.


The join keyword is very powerful in SQL. It can be used to combine rows from multiple tables by using
common values in certain fields. The type of join decides which rows are to be selected, while the
select statement specifies which fields to include in the combination table.


Inner Join
This is the default type of join. It picks all rows that have matching fields, or in other words, that meet the join condition.


Outer Join
A right outer join picks all rows from the table on the right, even if they do not meet the join condition. Some fields in such rows may have null values in the resulting table.A left outer join returns all rows of the left-side
table, irrespective of their match with the right-side table.


A full outer join returns all rows of the left- and
right-side tables.
Self Join

This is a special type of join where a table joins to
itself.

Cross Join
This is the Cartesian product of rows from the tables included in the join query statement. In other words,
every row from the first table is combined with every row of the second table, one at a time.


What is the SQL syntax for sorting, and which is the default order?


The default sorting order is ascending. These two statements are identical:
select from order by
select from order by asc
For descending order, simply replace “asc” with “desc.”

Wednesday, 14 May 2014

SQL is mainly divided into 4 sub languages


1. Data Definition Language (DDL).These commands are auto commit.
2. Data Manipulation Language (DML).
3. Transaction Control Language (TCL).
4. Data Control Language (DCL).


DDL(  DR CAT)
DML (SUDI)
TCL (CRS)
DCL (GR)
1.DROP
1.SELECT
1.COMMIT
1.GRANT
2.RENAME
2.UPDATE
2.ROLLBACK
2.RENAME
3.CREATE
3.DELETE
3.SAVEPOINT

4.ALTER
4.INSERT


5.TRUNCATE





There are 10 types  Database Objects in Oracle
6 in SQL and 4 in PL/SQL


6 Sql Database Object
1.TABLE
2.VIEWS
3.SYNONYMS
4.SEQUENCE
5.INDEX
6.CLUSTER


4  DATABASE OBJECT IN PL/SQL
1.FUNCTION
2.PROCEDURE
3.PACKAGE
4.TRIGGER